I have a table of sold items, with specified name, day, hour and amount of items sold.
What I need to do is for every day find the hour in which the greatest number of items (of any type) was sold and return the two-columned table with day and amount of items.
What I managed to do is to compute the sum of items per hour, but how to pick the hour with maximum amount of items sold and show it together with the day?
here is my lousy sqlfiddle attempt: http://sqlfiddle.com/#!9/93b51/17/0
select day, hour, sum(amount) as suma
from sold_items
group by day, hour