Re: Efficiency; advanced/future SQL constructs
From: Heinz Huber <hhuber_at_racon-linz.at>
Date: Wed, 22 Aug 2001 09:03:48 +0200
Message-ID: <3B835954.D07C3953_at_racon-linz.at>
Date: Wed, 22 Aug 2001 09:03:48 +0200
Message-ID: <3B835954.D07C3953_at_racon-linz.at>
Lennart Jonsson wrote:
>
> In article <6dae7e65.0108211341.5be42f54_at_posting.google.com>, Lennart Jonsson
> says...
> >
[...]
> >
> >Something like
> >
> >select employeeID, name from Employee where salary = (select
> >max(salary) from Employee)
> >
> >should work
> >
> >/Lennart
>
> Sorry, I overlooked the "in each of my company's divisions:". Please ignore my
> suggestion
No reason to be sorry ;-) With a small adjustment, the query works the way the OP wanted it:
SELECT employeeID, name, division
FROM Employee o
WHERE salary =
(SELECT MAX(salary)
FROM Employee i
WHERE o.division = i.division);
hth,
Heinz
Received on Wed Aug 22 2001 - 09:03:48 CEST
