I have the following script that shows the last 11 months of sysdate ...
Select * from (select level -1 as num, to_char (add_months (trunc (sysdate, 'MM'), - (level -1), 'MM') || '-' || to_char (add_months In the form of trunc (list-1), 'YYYY') (with dual connections with level as "current" from 0 to "dTE" = 12) axis (maximum (DTE) "DATE "As" DATE "1," 1 ", 2 to" 2 ", 3 like" 3 ", 4 like" 4 ", 5 to 5", 6 to 6 ", 7 to 7", 8 To "8", 9 like "8", 9 "9", 10 to "10", 11 to 11 " In the form))
I want to create a table showing the amount of delivery where the date of delivery ('MM-YYYY') is equal to the date from the above script.
I have the following
Select dp.catnr, NVL (zodiac (dp.del_qty), 0) from del_qty bds_dhead @ sid_to_cdsuk dh, bds_dline @ sid_to_cdsuk, get delivery volume and delivery date dp where dp.dhead_no = dh. D head_no and dh.d_status = '9' and dp.article_no = 9 || '2EDVD0007' and TO_CHAR (TRUNC (dh.actshpdate), 'Mm') || '-' || TO_CHAR (TRUNC (dh.actshpdate), 'YYYY') = = - This is where I would like to match the result of the above script group to dp.catnr
The result will look something like this ...
any The idea will be greatly appreciated.
Thank you, SMORF
as with date_series (add_months Choose (trunc (sysdate, 'mm'), 1-LVL) start_date, add_months (TRUNC (sysdate, 'mm'), 2-LVL) - 1/24/60/60 from end_date (selection dual-level LVL Level & lt Connect; = 12)), as your_table ('catnr1' catnr, 100500 del_qty, sysdate actshpdate from dual union select all 'catnr1' catnr, 10 del_qty, sysdate-30 from dual union, all actshpdate Select 'catnr2' catnr, 15 del_qty, select sysdate-60 from actshpdate dual), subtextual as DTE, t.catnr, yoga (NVL (t.del_qty, 0)) date_series DS to del_qty on your To join the _table t (t.actshpdate (TO_CHAR (select ds.start_date, 'MM-YYYY') TO_CHAR by ds.start_date and ds.end_date) group (between ds.start_date, 'MM- YYYY '), t.catnr * ('11 -2013' D1 for DTE, '12 -2013 'D2, '08 -2014' D10, 'for subquery spindle (del_qty) 9 -2014 'D11,' 10 -2014 'D12)) where the catcher is not futile;
Comments
Post a Comment