SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

phil2580
Starting Member

United Kingdom
2 Posts

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

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....


Thanks,

Phil

phil2580
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  
 New 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.03 seconds. Powered By: Snitz Forums 2000