var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Help with group by clause
My table structure
I want to get the EMPLOYEE with the highest salary in a particular department
will give me the maximum salary for departments but how to get the emp_id also..?
select dep_id, max(sal) FROM tbl_name GROUP BY dep_id
Last edited by Sudar; 12-22-05 at 01:37.
Ok I found out the query by myself. Here is it.
SELECT * FROM tbl_name WHERE (dept_id, sal) IN (SELECT dep_id, MAX(sal) FROM tbl_name GROUP BY dept_id)