Limit the amount of duplicates returned [message #1298] |
Thu, 18 April 2002 09:30 |
Aaron
Messages: 13 Registered: January 2002
|
Junior Member |
|
|
Hi all,
I have a simple question. I have a table that contains a bunch of ID's. The ID's can appear numerous times. I would like to pull from this table but only allow a certain amount of duplicates. For example: select * from id_table only allowing a maximum of 5 unique IDs through. Im aware of how to filter out duplicates all together but in this case I want the duplicates to come through, just not more than a number I specify.
Thanks
Aaron
|
|
|
Re: Limit the amount of duplicates returned [message #1311 is a reply to message #1298] |
Fri, 19 April 2002 09:31 |
Jay
Messages: 127 Registered: October 1999
|
Senior Member |
|
|
I'm not sure if you want duplicate or unique ID's returned. Your question mentions both.
In either case, I think you'll find inline views helpful. Here's an example:
select *
from (select * from id_table)
where rownum < 6
Regards,
-Jay
|
|
|