Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Count multiple fields by month
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

United Kingdom
2 Posts

Posted - 11/26/2012 :  05:01:24  Show Profile  Reply with Quote

I'm a bit stuck on this one...can anyone help please?

I've got a table (DW_Client) with a couple of status fields (Approved, Rejected), and a date field(CMDate). PK for each client is (C_UID)

I need to write a query that counts how many Clients were approved and rejected in each month, and the total number of Approvals submitted (Approval requests may cross the month boundary, so it's expected that Approved+Rejected won't total the number of requests)

| Month | Approved | Rejected | Total Requested |
| Jan | 21 | 3 | 42 |
| Feb | 20 | 6 | 28 |
| Mar | 12 | 1 | 19 |

and so on....



Starting Member

United Kingdom
2 Posts

Posted - 11/26/2012 :  05:22:34  Show Profile  Reply with Quote
I've cracked it :)
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000