0

Good day All,

My Oracle sql query returns these values, 20160801 TYPE1 14856 20160801 TYPE2 32543 20160801 TYPE3 32336 20160801 TYPE4 620 20160801 TYPE5 18 20160801 TYPE6 461705 20160801 NA 25 20160802 TYPE1 14828 20160802 TYPE2 32574 20160802 TYPE3 32285 20160802 TYPE4 621 20160802 TYPE5 18 20160802 TYPE6 461335 20160802 NA 25 20160803 TYPE1 14824 20160803 TYPE2 32593 20160803 TYPE3 32293 20160803 TYPE4 621 20160803 TYPE5 18 20160803 TYPE6 461752 20160803 NA 26

How can I convert that to,

TYPE 20160801 20160802 20160803 TOTAL ===================================== TYPE1 14856 14828 14824 44508 TYPE2 ... and so on TYPE3 TYPE4 TYPE5 TYPE6

All in one query. Note 1. I looked into pivot but I don't want to manually list out the dates; it should be dynamic. 2. Not just limited to 3 days.

Thanks for any assistance here.

jasmaar
  • 225
  • 3
  • 9
  • Possible duplicate of [Dynamic pivot in oracle sql](http://stackoverflow.com/questions/15491661/dynamic-pivot-in-oracle-sql) – sstan Aug 04 '16 at 15:58
  • If you want "dynamic" you will need to write dynamic SQL. Are you familiar with it? Or are you looking for someone else to write it for you? Then - dynamic SQL is generally not recommended, for a variety of reasons; many people use it when in fact they should use their reporting applications, which can do quick work of such requirements. –  Aug 04 '16 at 16:16
  • Possible duplicate of [How to make dynamic pivot in oracle PL SQL](http://stackoverflow.com/questions/32451072/how-to-make-dynamic-pivot-in-oracle-pl-sql) –  Aug 04 '16 at 16:20

0 Answers0