SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need some SQL programming help counting amounts
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

chef423
Starting Member

USA
6 Posts

Posted - 08/27/2014 :  16:13:15  Show Profile  Reply with Quote
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

chef423
Starting Member

USA
6 Posts

Posted - 08/27/2014 :  16:44:40  Show Profile  Reply with Quote
Total Sales for the Day, Employee Name, # of Covers
$567 Juan 22
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000