Free Newsletters:

SQLCourse
Interactive Online SQL Training

Search Database Journal:

HOME News MS SQL Oracle DB2 Access MySQL PHP SQL Etc Scripts Links Forums DBA Talk
SQL Courses
1
2
3
4
5
6
7
8
9
10
11
12
13
14


GROUP BY - Multiple Grouping Columns - What if?

What if you ALSO want to display their lastname for the query below:

SELECT max(salary), dept
FROM employee
GROUP BY dept;

What you'll need to do is:

SELECT lastname, max(salary), dept
FROM employee
GROUP BY dept, lastname;

This is a called "multiple grouping columns".

 

Go Back to previous GROUP BY clause page


SQL Course Curriculum
<<previous 1234567891011121314 next>>