The GROUP BY clause summarizes the result set into groups as defined in the query by using aggregate functions. The having clause furthur restricts the result set to produce the data based on a condition.The syntax are
[GROUP BY [ALL] expression [,expression]
I have used adventureworks database for the following example.......
SELECT Title, 'Total Vacation Hours'=VacationHours, 'Total SickLeaveHours'=SickLeaveHours
FROM HumanResources.Employee WHERE Title in ('Recruiter','Stocker')
ORDER BY Title, VacationHours,SickLeaveHours