| From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
|---|---|
| To: | Paulo Roberto Siqueira <paulo(dot)siqueira(at)usa(dot)net> |
| Cc: | PGSQL SQL <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: Select subset of rows |
| Date: | 2000-08-27 21:08:27 |
| Message-ID: | Pine.BSF.4.10.10008271404001.47801-100000@megazone23.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Of course immediately after sending the last message and logging off my
ISP I figured out the simpler way for the third one:
begin;
select salary into temp saltemp from employee order by salary desc
limit 5;
select name from employee where exists (select * from saltemp where
saltemp.salary=employee.salary);
end;
Stephan Szabo
sszabo(at)bigpanda(dot)com
On Sun, 27 Aug 2000, Paulo Roberto Siqueira wrote:
> Hi folks,
>
> I have this table
>
> CREATE TABLE EMPLOYEE (ID_EMP INT4 PRIMARY KEY, NAME VARCHAR(35), SALARY
> NUMERIC(5,2));
>
> I want to select only the employees' names who have the 5 highest salaries.
>
>
>
>
> Paulo Siqueira
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mitch Vincent | 2000-08-27 22:01:02 | Re: queries and inserts |
| Previous Message | Stephan Szabo | 2000-08-27 20:55:30 | Re: Select subset of rows |