I need to count two data in same table for 2 time periods.
I tried something like this:
SELECT COUNT(CASE
WHEN click_date='2011-06-20' THEN 0
ELSE 1
END) AS ThisDayCount, COUNT(1) ToDayCount
FROM MyTable
WHERE click_date BETWEEN '2011-05-01'AND 2011-06-20;
So basically i want to have count from one day as ThisDayCount and count from 2011-05-01 to 2011-05-20
click_date is a String.
1 Answer