Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to show limit number or records within a group

Status
Not open for further replies.

Versys

Programmer
May 4, 2004
14
US
I have a table with several records group by another field, more than 100 records. I need to show in a SELECT only 3 or 5 records per group

Like this
SOURCE

Number Group
------ -----
1 1
2 1
3 1
4 1
11 2
12 2
13 2
14 2

Result desired

Number Group
------ -----
1 1
2 1
11 2
12 2

Let's say 2 records per group out of the total records from that group.

Thanks
 
How to add sequence number within groups of repeating values faq183-5021. Then do a Select * from the temporary table where SequenceNumber < 5 or so.
-Karl

[red] Cursors, Triggers and User Definded Functions are part of the Axis of Evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top