Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Grouping question?

Author  Topic 

louiedogg418
Starting Member

28 Posts

Posted - 2011-04-18 : 15:06:03
ok so this is the last question i have on this weeks homework, and i dont know how to interpret it...


o Select employees’ last names and group them by salary in job titles, grouped into exempt and non-exempt

how does one do a double group?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-04-18 : 15:10:56
It sounds like you just need to have two columns in the GROUP BY.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-04-18 : 15:16:10
You can group by both - but it will do exactly that - there will be each group will be for a unique combination of job title and exempt/non-exempt.

If you are on SQL 2005 or higher, you might want to see if CUBE and ROLLUP would be useful. If you are on SQL 2008, GROUPING SETS would probably be your answer.
Go to Top of Page

louiedogg418
Starting Member

28 Posts

Posted - 2011-04-18 : 15:16:43
how do you do that? like group by sal, job_title, last_name group by Exempt_stat?
Go to Top of Page

louiedogg418
Starting Member

28 Posts

Posted - 2011-04-18 : 15:16:44
how do you do that? like group by sal, job_title, last_name group by Exempt_stat?
Go to Top of Page
   

- Advertisement -