![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Sep 2004
Posts: 47
Rep Power: 0
![]() |
MSSQL - Help with query performance
I have a status column in a table with about 20 different status.
This table also has a date column. I want to get the totals for each status and date as separate fields. The only way I know to do this is creating temporary tables for each status (containing the date, status, and count) and relating them all by the date in a final query and grouping by the date and status. I'm looking for help here on how to do this in a more effective way, because all these temporary tables are slowing down my query alot. Thanks |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Mar 2005
Posts: 208
Rep Power: 4
![]() |
Re: MSSQL - Help with query performance
Um, wait, you have a table, with a status column, and a date column, and you want the total of each status for each date?
If that's it (and I'm not messing this up) then it's a piece of cake select status, date, count(*) from table_name group by status, date ; Done If I've missed your question entirely, please respond with an example of what you are looking for. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SQL injection on an insert query. | TCStyle | Other Web Development Languages | 2 | Nov 5th, 2006 7:14 PM |
| Slow Performance Counter | coder0xff | C++ | 2 | May 31st, 2006 9:29 PM |
| Process Id to Performance Counter Name | coder0xff | C++ | 1 | May 29th, 2006 11:19 AM |
| C# VS 2005 - SQL Query Parameters to an ODBC DataSource | jcrcarmo | C# | 3 | Apr 10th, 2006 3:58 PM |