Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Oracle (https://www.askmehelpdesk.com/forumdisplay.php?f=443)
-   -   Oracle Group By Clause (https://www.askmehelpdesk.com/showthread.php?t=248764)

  • Aug 14, 2008, 01:16 AM
    Kalpana_pipl
    Oracle Group By Clause
    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...
  • Dec 8, 2008, 05:16 PM
    ordba

    Try and use subselect...

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

  • All times are GMT -7. The time now is 09:51 PM.