Re: Tricky SQL Problem: Top "n" of queried records
From: Johan Thorselius <jt_at_outright.se>
Date: 1998/03/21
Message-ID: <3514160F.9548D005_at_outright.se>#1/1
Date: 1998/03/21
Message-ID: <3514160F.9548D005_at_outright.se>#1/1
Brenda Muller wrote:
> In Sybase (and Sybase alone), you can "set rowcount 3" at the beginning of your
Yes, the following should be equiv. in Oracle:
SELECT deptno, sum(salary) FROM emp
But you must sort the resultset so the rows you are interested in are placed first.
> transaction, which will restrict the server to returning only 3 rows. There is
> nothing analogous to this in Oracle.
>
> Brenda Muller
>
GROUP BY deptno
...order by something relevant....
WHERE ROWNUM < 4;
Best regards
Johan Thorselius
Received on Sat Mar 21 1998 - 00:00:00 CET