PDA

View Full Version : Oracle Group By Clause


Kalpana_pipl
Aug 14, 2008, 01:16 AM
Hi all,

How to select a field that is not a part of the Group By clause?

Suppose a table contains Emp_No, Emp_Name,Dept_No,Salary...
I have to select the emp_no or emp_name who are get the maximum salary in Dept_No wise..
How do I achieve this through a single SQL ?
Guide me

Thanks is advance...

ordba
Dec 8, 2008, 05:16 PM
Try and use subselect...

Select emp_name from
(select emp_name,dept_no,max(salary) from emp group by emp_name,dept_no);