当前日期的 Netezza 日期函数 - 16 天 [英] Netezza date function for current date - 16 days

查看:59
本文介绍了当前日期的 Netezza 日期函数 - 16 天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提取今天的日期加上过去四个星期的日期.有没有人知道 Netezza 中的这个功能?我下面的猜测是行不通的.另外,我不想提取日期.

I want to pull today's date plus the last four weeks. Does anyone know a function for this in Netezza? What I have below is a guess that doesn't work. Also, I don't want to extract the date.

 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)

推荐答案

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

Assuming inv_dt is the column you want to filter on, your where predicate should include:

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

16 天不等于 4 周,但请根据您的需要相应地调整该数字.

16 days does not equal four weeks, but adjust that number accordingly to your needs.

这篇关于当前日期的 Netezza 日期函数 - 16 天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆