I have data for 2 weeks, coming out of a complex 'statement' -
DATE WEEKDAY CODE 2015/01/05 Monday A 2015/01/06 Tuesday a 2015/01/07 Wednesday P 2015/01/08 Thursday A 2015/01/06 Friday P 2015/01/12 Monday P 2015 / 01/13 Tuesday P 2015/01/14 Wednesday P 2015/01/15 Thursday P 2015/01/16 Friday P
And I want to move in two weeks like this - < / P>
WEEK Monday Tuesday Wednesday Thursday Friday 2015/01/05 AAPEP 2015/01/12 With PPPPP select PS_Att_Piwot_data AS (--------------) * (Select (case ('Monday', 'Tuesday', 'Wednesday', ' Thursday, 'Friday')) PIVOT for weekends (maximum CODED) weekend = School days ends after 'Monday.'
My script is giving results like Monday '' Tuesday '' Wednesday '' Thursday '' Friday (Null) (Null) PPPP 2015/01/12 P (Null) (Null) (empty) (zero) 2015/01/05 A (faucet) (faucet) ) (Null) (r Expressed)
Please help me with the axis statement. Thank you,
It seems that what might happen next to you:
< ('05 / 01/2015 ', '05 / 01/2015', 'dd / mm / yyyy') DT, 'Monday' day of the week, 'A' code with Dual Union Select All Select ('06 / 01/2015 ',' Wednesday 'working day,' DD / MM / YY 'DT,' Tuesday 'workday, select' A 'code from dual union ('07 / 01 / 2015 ',' DD / MM / Yay '), Select all from' P 'Code Dual Union ('08 / 01/2015', 'dd / mm / yyyy') Dot Please select all from 'A' Code Dual Union, select 'Everyone' ('09/01 / DD / MM / YY' DT, 'Friday' Workday, 'P' Code Dual Union Select all '12 / 01/2015 ',' dd / mm / yyyy ') dt,' Monday 'on the afternoon, select all from' P 'Code Dual Union ('13 / 01/2015', 'DD / MM / Yay ') DT,' Tuesday 'workday, select all from' P 'Code Dual Union ('14 / 01/2015', 'DD / Me M / yyyy') DT, 'Wednesday' Workday, 'P' Code Select all from Dual Union ('15 / 01/2015 ',' DD / mm / yay ') DT,' Thursday 'workdesign, select all from' P 'code Dual Union ('16 / 01/2015', 'dd / mm / yyyy') dt, 'Friday' workday, two From 'P' code) - End the copy of your data in the table named sample_data * (select trunc (dt, 'iw') week_start_dt, weekdays, code from sample_data) Pivot (max (code) for week ('Monday' As of Monday, 'Tuesday' Tuesday, 'Wednesday' as Wednesday, 'Thursday' as Thursday, 'Friday' as Friday)) week_start_dt Order by: WEEK_START_DT Monday Thursday Wednesday Friday Friday ------------- ------------- --------- -------- - ----- 2015/01/05 AAPAP 2015/01/12 PPPP I sincerely expect that WEEKDAY
comes from DT column in your real code is !
No comments:
Post a Comment