Reputation: 1550
I want to summarize sql query result week wise and month wise at the same time in a grid view. Is this even possible or I am just dreaming?
Requirement:
Show last one month data and next two month's data week wise in the grid.
Example-
Show the data after the next month of current month in month wise view in the same grid.
Example-
grid or result should look something like below -
Please suggest something to achieve this
Upvotes: 0
Views: 393
Reputation: 750
I think you must work with group by or group by ... cube
SELECT x , y from <tabel> GROUP BY date_feld( to_char( 'MM' ))
but i don't now your DBMS so i can't give you a exact example for the date handling.
Upvotes: 1
Reputation: 6979
If you want a maintainable solution, use two independent queries, one for weekly aggregation other for monthly. Depending on the input run corresponding query.
Upvotes: 1