Posted - 08/27/2014 : 16:13:15
| Hi everyone, I need some basic SQL programming help.
I have a data set that is for a restaurant. We need to find the total amount in sales (c_items_total) for each unique user plus the number of covers (patrons) for the same day.
The table is below. I know how to use the SUM() function but I don't know how to add up all the sales for each User (employee) per day, and then also total the covers (patrons) for that day as well.
So, Total_Sales, Employee, # of Covers (for a given day)
Such as, User#1 has 10 tables for the day plus 30 people total he served.
Thanks in advance!!!
select t.c_items_total, t.i_user_id, t.i_void_ticket_id, e.s_name, t.cover_count
FROM Ticket AS t
INNER JOIN Employees AS e
ON t.i_user_id = e.i_employee_id
WHERE t.i_void_ticket_id > 0
GROUP BY t.c_items_total, t.i_user_id, t.i_void_ticket_id, e.s_name, t.dt_create_time, t.dt_close_time, t.cover_count