I am encountering a situation where, I have a data. I need to capture count of the row, project_id, for each date, within a given range of date.
e.g.: user enters date as:
set @start_date = '2016-01-01';
set @end_date = '2016-09-30';
|Project id| |Tracker id| |Statusid| |Hours| |Hours| |Date Created| |Date Updated| |Count when created|
'Cyrcle Connect', '5', '1', NULL, NULL, '2016-07-12 02:33:18', '2016-09-13 07:32:33', '3'
|Count when Created| |Count when 2016-02-10|
3 5
Try this:
select DATE(Date_Created) as R_DATE , COUNT(*) as R_COUNT
from <your table>
where DATE(Date_Created) >= @Start_Date
and DATE(Date_Created) < @End_Date
group by R_DATE
;
You can also use the between
for the time window (I prefer the above as it is clearer for me).