I am lost on how to solve what I believe should be a simple query.
I want to count the number of entries for each date in a table. The column DateCreated
is in DateTime
format. I can convert the datetime
to date using
convert(VARCHAR, JobApps.DateCreated, 2) as Date
but with COUNT(ID) as Qty
I get a count of 1 with multiple "Date" rows.
Here is the SQL query I am using.
SELECT
convert(VARCHAR, DateCreated, 2) as Date, COUNT(CompanyName) as Qty
FROM Apps
GROUP BY DateCreated
ORDER BY DateCreated DESC
This is the results I get.
Date Qty
------------------
13.05.29 1
13.05.29 1
13.05.29 1
13.05.29 1
13.05.29 1
13.05.28 1
13.05.28 1
13.05.27 1
13.05.27 1
etc...
What I wanting is a result like this...
Date Qty
-----------------
13.05.29 5
13.05.28 2
13.05.27 2
etc...