Question : MS SqL query

Already have the following query that sums up sales by server.

SELECT CK_SERVER as Server#,
      
       COUNT(CK_CHECKNO)as Checks,
       SUM(CK_FOOD+CK_BEVG+CK_BEER+CK_WINE+CK_LIQUOR+CK_OTHER) AS ItemsSold,
       SUM(CK_TAX) AS Tax,
       SUM(CK_TIP) AS Tips,
       SUM(CK_DISCOUNT) AS Discounts,
SUM(CK_COVERS) AS Covers,
       SUM(CK_FOOD+CK_BEVG+CK_BEER+CK_WINE+CK_LIQUOR+CK_OTHER + CK_TAX + CK_TIP - CK_DISCOUNT) AS Total
FROM V1REST.dbo.RSTCHIST
where CK_DATE >= '05/01/2009' and CK_DATE <= '05/18/2009' and RESTNO = '1' and CK_STATUS = 'c'
GROUP BY CK_Server
Order by CK_Server

Now the manager wants it to be based on Meal Period (CK_Meal). So now I have bring in the field called CK_Meal and group by that first then group by CK_Server
How??

Answer : MS SqL query

Then try this one out:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
SELECT CK_SERVER as Server#,
       CK_MEAL,
       COUNT(CK_CHECKNO)as Checks,
       SUM(CK_FOOD+CK_BEVG+CK_BEER+CK_WINE+CK_LIQUOR+CK_OTHER) AS ItemsSold,
       SUM(CK_TAX) AS Tax,
       SUM(CK_TIP) AS Tips,
       SUM(CK_DISCOUNT) AS Discounts,
SUM(CK_COVERS) AS Covers,
       SUM(CK_FOOD+CK_BEVG+CK_BEER+CK_WINE+CK_LIQUOR+CK_OTHER + CK_TAX + CK_TIP - CK_DISCOUNT) AS Total
FROM V1REST.dbo.RSTCHIST
where CK_DATE >= '05/01/2009' and CK_DATE <= '05/18/2009' and RESTNO = '1' and CK_STATUS = 'c'
GROUP BY CK_MEAL,CK_Server
Order by CK_Server 
Open in New Window Select All
Random Solutions  
 
programming4us programming4us