help in a sum query
help in a sum query
(OP)
Hi Guys, I am on a tight deadline. I have a query that returns data similar to the following:
State City JanSum FebSum MarSum... DecSum
CA LA 1000 500 300 ... 200
CA SF 500 500 200 ... 300
TX Dallas 300 100 50 ... 150
TX Hou 120 400 0 ... 0
I need help in writing a query that returns the results as follows:
State City JanSum FebSum MarSum... DecSum
All All 1920 1500 550 650
All LA ... ... ... ...
All SF ...
All Dallas ...
All Hou ...
CA All ...
TX All ...
Is this achievable through a query? I am using SQL Server database. Please advise how to achieve this with some sample code if possible. Thanks in advance.
State City JanSum FebSum MarSum... DecSum
CA LA 1000 500 300 ... 200
CA SF 500 500 200 ... 300
TX Dallas 300 100 50 ... 150
TX Hou 120 400 0 ... 0
I need help in writing a query that returns the results as follows:
State City JanSum FebSum MarSum... DecSum
All All 1920 1500 550 650
All LA ... ... ... ...
All SF ...
All Dallas ...
All Hou ...
CA All ...
TX All ...
Is this achievable through a query? I am using SQL Server database. Please advise how to achieve this with some sample code if possible. Thanks in advance.
RE: help in a sum query
As an aside, I think you need to read this: FAQ222-2244: How to get the best answers
It is nice to post back and let people who've offered advice know whether it worked or not.
Alex
----signature below----
I'm pushing an elephant up the stairs
My Crummy Web Page