mysql count() range
hi I have something like this
tickets
-----------------------------------
|CreatedOn | IssueType |
-----------------------------------
|2007-12-04 11:29:43 | 'Phone' |
|2007-12-04 11:29:43 | 'Web' |
|2007-12-04 11:29:43 | 'Web' |
|2007-12-05 11:29:43 | 'Web' |
|2007-12-05 11:29:43 | 'Phone' |
|2007-12-05 11:29:43 | 'Phone' |
|2007-12-05 11:29:43 | 'Web' |
|2007-12-06 11:29:43 | 'Web' |
|2007-12-06 11:29:43 | 'Web' |
|2007-12-06 11:29:43 | 'Phone' |
|2007-12-06 11:29:43 | 'Phone' |
|2007-12-06 11:29:43 | 'Web' |
-----------------------------------
I want this count how may 'web' for the date range?
Like this
-------------------------------
|cDate |count(IssueType)|
-------------------------------
|2007-12-04 | 2 |
|2007-12-05 | 2 |
|2007-12-06 | 3 |
-------------------------------
This is what I have so far:
Select Date(CreatedOn)as cDate, count(IssueType) from tickets where IssueType = 'Web' and CreatedOn >= '2007-12-04%' AND CreatedOn <= '2007-12-06%' group by CreatedOn
and this is what I am getting
-----------------------------------
|cDate |count(IssueType)|
-----------------------------------
|2007-12-04 | 1 |
|2007-12-04 | 1 |
|2007-12-04 | 1 |
|2007-12-05 | 1 |
|2007-12-05 | 1 |
|2007-12-05 | 1 |
|2007-12-05 | 1 |
|2007-12-06 | 1 |
|2007-12-06 | 1 |
|2007-12-06 | 1 |
|2007-12-06 | 1 |
|2007-12-06 | 1 |
-----------------------------------
Natdrip :P
"water go down the hole" - plucky duck
Bookmarks