Re: Efficiency; advanced/future SQL constructs

From: David Cressey <david_at_dcressey.com>
Date: Wed, 22 Aug 2001 12:51:22 GMT
Message-ID: <eVNg7.284$Iw2.19099_at_petpeeve.ziplink.net>


You solution just needs to be fixed up a little, to take into account the DivisionId.

Here's my shot at it, from your solution:

select employeeID, name from Employee E1 where salary = (select max(salary) from Employee e2 where E2.DivisionId = E1.DivisionId)

(I don't have the original in front of me, so I don't remember if "DivisionId" is the actual
name of the variable he mentioned. But this should be close enough to get the concept across.)

--
Regards,
    David Cressey
    www.dcressey.com
Received on Wed Aug 22 2001 - 14:51:22 CEST

Original text of this message