Home » SQL & PL/SQL » SQL & PL/SQL » Query Help
Query Help [message #234766] Thu, 03 May 2007 02:26 Go to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member

Hi,
In a table Emp i want to select those employees are taken maximum leave in a month in department wise.

Expecting outout:

Department employee days

Keynote arun 3
shakil 3

performix nisha 4
shaju 4


Airdefence ramesh 2


i need a standard query..Pls help..(note: keynote ,performix,airdefence are department).

Regards,
Arun

Re: Query Help [message #234771 is a reply to message #234766] Thu, 03 May 2007 02:29 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Would you *please* start using code tags. I can't make anything out of it. What is your layout of the table EMP? Scott's EMP table does not have information about absence.

So:
- table layout
- expected output
- CODE TAGS

MHE
Re: Query Help [message #235017 is a reply to message #234766] Thu, 03 May 2007 14:21 Go to previous message
Ericle
Messages: 44
Registered: April 2006
Location: United States of America ...
Member

akkumar81 wrote on Thu, 03 May 2007 03:26
Hi,
In a table Emp i want to select those employees are taken maximum leave in a month in department wise.

Expecting outout:

Department employee days

Keynote arun 3
shakil 3

performix nisha 4
shaju 4


Airdefence ramesh 2


i need a standard query..Pls help..(note: keynote ,performix,airdefence are department).

Regards,
Arun




Your details are sketchy, but I'm going to give this a shot, anyway.

select dept.department, emp.employee, emp.days
from   dept, emp
where  dept.dept_id = emp.dept_id
and    emp.days = (select max(days) from emp emp2
                   where emp2.dept_id = emp.dept_id)

Previous Topic: Need help on Triggers
Next Topic: Formatted output from Oracle
Goto Forum:
  


Current Time: Wed Dec 07 12:33:05 CST 2016

Total time taken to generate the page: 0.05027 seconds