Hello,
Im trying to construct a query and am having a hard time wrapping my head around the concept of what I want to do. It seems like the term sub-select would best describe it, but im not sure if that is the correct termonology. Anyway, let me try to explain my situation.
I have a tracking table that has an auto_increment'ing ID, a date field and several columns indicating clicks.
so a short example table would be:
ID | date | click1 | click2 |
I would like to construct a query that gives me click totals for a particular date range. So i would want a row returned for each date that totaled all click 1's and click 2's.
Take for example the following date sets:
ID | date | click1 | click2 |
1 | 7/3/2003 | 3 | 5
2 | 7/3/2003 | 2 | 8
3 | 7/3/2003 | 9 | 6
4 | 7/4/2003 | 3 | 5
5 | 7/4/2003 | 1 | 5
So i would like to be able to get the total clicks on the 3rd and the 4th of july - regardless of the ID.
I can get the total clicks for all dates, with
SELECT SUM(click1) as click1, SUM (click2) as click2 FROM <table> WHERE date>=20030703 AND date <= 20030704
But I cant figure out how to get the sums of each date individually. I would prefer to do this in 1 query if possible and not have to issue a query for each date in the range.
TIA!