I am trying to convert columns into rows. I have input data like below in the Oracle Table EMP -
At runtime, user can pass their own start time and end time, for ex suppose - 15-Dec-2020 to 31-Dec-2021. In this case, he should get the result like below for each MONTH END which falls between these dates -
Here "1" is nothing but the value of HEADCOUNT column value.
so MONTH END columns names are generating dynamically.
I tried below query but it is not fullfilling my requirement. DATE_PERIOD is a normal date time table having all the dates details(like month end, day name, quarter etc) for next 20 years). I tried PIVOT function as well in oracle but not able to generate the desired output. Can someone please help!!
I am able to write another query to produce the MONTH_END_DATE in the rows.