Re: how to count the number of each item per day On Mar 18, 4:08 pm, omeld...@gmail.com wrote:
> hello. let's say i have a table with dates and items. on a given date,
> many items can be chosen, but only one at a time. i've been trying
> hard the whole day to find a solution for counting the number each
> item was chosen on a given day.
> selecting the total number each item was chosen is easy: select item,
> count(item) from table group by item; but i want to do this for each
> day.
>
> for example, i expect a result like this:
>
> day - item - count
> 1 apple 3
> 1 orange 7
> 2 apple 1
> 2 banana 10
> 2 pear 15
>
> etc.
>
> thanks.
SELECT *,count(*) FROM mytable GROUP BY day |