Group rows into totals
Return one summary row for each group key.
What you are trying to do
A service review compares synthetic ticket counts and effort by team.
Work through it
- Identify the grouping column.
- Trace each aggregate back to its input rows.
- Check which groups pass the HAVING condition.
Check your work
Each returned team has the expected count and total effort.
Practice SQL
Open in SQL FlowSELECT Team, COUNT(*) AS TicketCount, SUM(Effort) AS TotalEffort FROM (VALUES (N'North', 20), (N'North', 15), (N'South', 40)) AS Work(Team, Effort) GROUP BY Team HAVING SUM(Effort) >= 30 ORDER BY Team;
Commands in this lesson
Next lesson Name a query step