I am trying to create a query that will generate the following table.
I know the column names (that is start and end date of each column. These dates will vary based on the month/year. Also the number of columns will vary since some month may have 6 weeks).
The number of pools may also vary. There can be ‘n’ number of pools. So I have create a query for each pool(row) and for each week(column).
Assume there are 3 pools(3 rows) and 5 weeks (5 columns), I may need to run 3*5=15 queries.
Is there any way to create a single query to fix this?
Can anyone help me in fixing this?
I am stiil working on this..
--------------------------------------------------
row 0 | week1 | week2 | week3 | week4 | week5 |
st-end|jan1 -2|jan 3-9|jan10-17|jan18-24|jan25-31|
--------------------------------------------------
pool a| 100 | 105 | 309 | 345 | 234 |
pool b| 106 | 108 | 399 | 245 | 214 |
pool c| 120 | 145 | 359 | 365 | 274 |
--------------------------------------------------
Have you tried to do it using CASE expressions? [See “Control Flow Functions”]
Something along these lines: