当前日期的Netezza日期函数 - 16天

时间:2015-05-14 20:27:38

标签: netezza

我想拉今天的日期和过去的四周。有没有人知道Netezza的功能?我下面的内容是猜测不起作用。另外,我不想提取日期。

 Select c.BUSINESS_UNIT_NBR, c.BUSINESS_UNIT_NAME, b.STORE_NBR, b.INV_CUST_ACNT_NBR,c.INV_CUST_NAME, a.NDC_NBR, a.GENERIC_NAME, a.INV_NBR, a.CONTRACT_ID, a.CONTRACT_NAME, a.ORD_DT, b.INV_DT, b.SHIP_DT, a.ORD_QTY, a.SHIPPED_QTY, a.INV_PRICE_AMT, a.INV_COST_AMT, a.MARKUP_MARKDOWN_PCT, a.INV_LINE_AMT
    from fct_dly_invoice_detail a, fct_dly_invoice_header b, dim_invoice_customer c
    where a.INV_HDR_SK = b.INV_HDR_SK
    and b.DIM_INV_CUST_SK = c.DIM_INV_CUST_SK
    and a.SRC_SYS_CD = 'ABC'
    and a.NDC_NBR is not null 
    **and b.inv_dt(current_date)-16**
    and b.store_nbr in (813, 1197, 2771, 3048, 3177, 3387, 3477, 3602, 3766, 3912, 4020, 4138, 4228, 4434, 4435, 4507, 4742, 4791, 5353, 5392, 5775, 5776, 5890, 6177, 6692, 6736, 6806, 7933, 9175, 9472)

1 个答案:

答案 0 :(得分:3)

假设inv_dt是您要筛选的列,则where谓词应包括:

WHERE 
...
inv_dt between CURRENT_DATE - 16 and CURRENT_DATE
...

16天不等于四周,但根据您的需要调整该数字。