Netezza date function for current date - 16 days -
i want pull today's date plus last 4 weeks. know function in netezza? have below guess doesn't work. also, don't want extract 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 fct_dly_invoice_detail a, fct_dly_invoice_header b, dim_invoice_customer c a.inv_hdr_sk = b.inv_hdr_sk , b.dim_inv_cust_sk = c.dim_inv_cust_sk , a.src_sys_cd = 'abc' , a.ndc_nbr not null **and b.inv_dt(current_date)-16** , 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)
assuming inv_dt column want filter on, predicate should include:
where ... inv_dt between current_date - 16 , current_date ...
16 days not equal 4 weeks, adjust number accordingly needs.
Comments
Post a Comment