Jump to content

Issue with MIN and Group BY


karatekid36

Recommended Posts

With the below query, it returns the MIN salary for each department, but what if you want to list the EMP_ID or EMP_NAME in this list as well? Meaning you want to see the EMP_ID in the department that has the MIN(salary).  Won't that end up expanding the returns to more or less all rows?

 

 

SELECT department, MIN(salary) as "Lowest salary"

FROM employees

GROUP BY department;

 

Thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/252129-issue-with-min-and-group-by/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.