SQL Query COUNT function
Posted on 2010-11-19
I need some help in trying to run a query on our SQL server that will count several fields. I tried to do this in simple statment but got no where, so I created the following stored procedure which get me the correct count but the the software I created that for cannot recognize stored procedures.
Is there any other way to do the below in a SELECT query?
SELECT COUNT (field1) AS Total, AddedOn FROM applications Group By AddedOn
Select COUNT (field2) As ADTotal FROM Applications where field2 = 1 GROUP BY AddedOn, Field2
What I am trying to do is to count several fields within the same table and group them by date received so the results will be something like
Date Total ADTotals
09/01 2 4
09/01 1 8
09/02 5 30
I need to count total of six fields in the same table.