net
net

Reputation: 91

access2016: sql query to get sum per date

Pls help

in access 2016 query, I have a table status with fields & datatype: date_created (date/time) status (shorttext) type (shorttext)

I want to calculate the total number of count of request for each day.

Using below select:

SELECT tbl_status.date_created, tbl_status.Type, COUNT(Type) AS No_Type
FROM [tbl_status]
GROUP BY tbl_status.Type, tbl_status.date_created
ORDER BY tbl_status.date_created;


date        Type      No_Type
28-Sep-18   Sales       5
28-Sep-18   Marketing   3
27-Sep-18   Marketing   1
05-Sep-18   Marketing   2
05-Sep-18   Sales       1
05-Sep-18   Account     6

for 28-sep-18 total_count_per_day should be 8

Upvotes: 0

Views: 43

Answers (1)

Fahmi
Fahmi

Reputation: 37473

Yoy need to remove tbl_status.Type from group by

SELECT tbl_status.date_created, count(Type) AS No_Type
FROM [tbl_status]
GROUP BY tbl_status.date_created
ORDER BY tbl_status.date_created;

Upvotes: 1

Related Questions