Microsoft SQL Server GROUP BY multiple columns

Example

One might want to GROUP BY more than one column

declare @temp table(age int, name varchar(15))

insert into @temp
select 18, 'matt' union all
select 21, 'matt' union all
select 21, 'matt' union all
select 18, 'luke' union all
select 18, 'luke' union all
select 21, 'luke' union all
select 18, 'luke' union all
select 21, 'luke'

SELECT Age, Name, count(1) count
FROM @temp 
GROUP BY Age, Name

will group by both age and name and will produce:

AgeNamecount
18luke3
21luke2
18matt1
21matt2