ROW TO COLUMN CONVERSION

Database

ROW TO COLUMN CONVERSION

Folks I have a staging table which gives data as shown below.

Month Hotel_id Loss_Incured
Mar 63 200
Apr 63 300
Jun 63 400

I got the missing month from the hotel_Calendar table and my result set looks like this

Month Hotel_id Loss_Incured
Mar 63 200
Apr 63 300
May 63 0
Jun 63 400

I want to show a result set like the following..
1 REPLY

Re: ROW TO COLUMN CONVERSION

You can use sys_calendar.calendar (or create your own view based on it with desired columns and level of detail) and LEFT OUTER JOIN with your table to get missing months/years. Make sure, to apply appropriate filters to calendar view to restrict data to specified date range.