I'm grouping the months according to two date ranges. The months will change in each posted date range. I need to convert months into columns. Dates can also cover the next year. I need to do this in HQL.
I have a table like this:
| ID | Product| Month | Sales
| 1 | A | 8 | 500
| 2 | B | 8 | 200
| 2 | B | 9 | 600
| 3 | C | 9 | 700
| 4 | D | 9 |
| 4 | D | 10 |
| 4 | D | 11 |
| 5 | E | 11 |
I want it to be like this:
| ID | Product| 8 | 9 | 10 | 11 |
| 1 | A | 500 | | | |
| 2 | B | 200 |600 | | |
| 3 | C | |700 | | |
| 4 | D | | # | # | # |
| 5 | E | | | | # |
Thanks