Reputation: 569
I am getting count of some column by using group by
. It returns results of the form,
date1 1
date2 2
I would like to further count on this result so that it returns 3
.
How would I go about accomplishing this?
SELECT t.p_date
,count(t.p_date) AS saturday
FROM t_p_booking t
WHERE t.p_id IN (
220
,221
)
AND dayofweek(t.p_date) = 7
AND date_format(t.p_date, '%Y%m') = : ccyymm
GROUP BY t.p_date
Upvotes: 0
Views: 84
Reputation: 78
Would that not just be:
SELECT count(*)
FROM t_p_booking t
WHERE t.p_id IN (
220
,221
)
AND dayofweek(t.p_date) = 7
AND date_format(t.p_date, '%Y%m') = : ccyymm
GROUP BY t.p_date
Upvotes: 2