------------------------------ Commands Entered
------------------------------
SELECT L, U, name, age, department
FROM (SELECT q.*, L, U
, ROWNUMBER() OVER(PARTITION BY L ORDER BY age) rno
FROM RANGE_TEST q
, (VALUES (20,29), (30,39), (40,49)) Range(L, U)
WHERE age BETWEEN L AND U
) r
WHERE rno = 1
ORDER BY age;
------------------------------------------------------------------------------
L U NAME AGE DEPARTMENT
----------- ----------- ------- ------ ----------
20 29 janet 22 HR
30 39 Nancy 33 Sales
40 49 John 45 IT
3 record(s) selected.
janet - 25 Feb 2005 03:21 GMT
hi, Tonkuma
Thanks very much for quickly response! Both answered my question. The
second way is more flexible...
> ------------------------------ Commands Entered
> ------------------------------
[quoted text clipped - 16 lines]
>
> 3 record(s) selected.