473,479 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Limit Number of Returned Records per Name

Hi All,

I have a query in access that has multiple records for each person.
The query is currently sorted by year then by name. No person has
records in more than one year.

What I would like to do is return only the first 5 records from each
name. Some names may have less and some more.

Any ideas on how to do this? I know that in SQL I can use the "SELECT
TOP 5" etc, however I think this would require a different query for
each person which would then have to be unioned.

Any help is appreciated, Thanks!!

Aug 16 '07 #1
1 1609
Can you post your simplified table structure with some sample data and
the output you need? Also you need to tell is what 'first' means in the
context of your data, (youngest, oldest etc)
andrewbda wrote:
Hi All,

I have a query in access that has multiple records for each person.
The query is currently sorted by year then by name. No person has
records in more than one year.

What I would like to do is return only the first 5 records from each
name. Some names may have less and some more.

Any ideas on how to do this? I know that in SQL I can use the "SELECT
TOP 5" etc, however I think this would require a different query for
each person which would then have to be unioned.

Any help is appreciated, Thanks!!
Aug 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1740
by: Mike | last post by:
New to PHP and MySQL. Using PHP5 and MySQL 4.1 Windows XP Pro IIS 5.1 I'm trying to page a recordset, and am using a LIMIT clause to fetch a defined range of records from my db. However, the...
0
5746
by: D. Dante Lorenso | last post by:
I need to know that original number of rows that WOULD have been returned by a SELECT statement if the LIMIT / OFFSET where not present in the statement. Is there a way to get this data from PG ?...
3
3680
by: CSDunn | last post by:
Hello, I have a situation with MS Access 2000 in which I need to display report data in spreadsheet orientation (much like a datasheet view for a form). If you think of the report in terms of what...
6
12327
by: Hannu | last post by:
Hi. In the ldb file you can see the users of the mdb-file. If you open the mdb-file your machine and username will be written in the lbd- file. Allthough you close the mdb-file your name won't...
3
6625
by: deko | last post by:
Is there any way to limit the number of records loaded into a ListBox? I looked at qdf.MaxRecords (to apply to the query that is the RowSource of the ListBox) but that only applies to ODBC data...
9
13733
by: campbellwarren | last post by:
Does anyone know how I could limit the number of rows allowed in a MS Access table... want to limit it to 1.
2
9135
by: someone | last post by:
How can I limit the number of records a Query retrieves or at least limit the number of records returned on a report. I only want to print the top 5 or 10 returns of a query into a weekly reort....
2
3315
by: pavlin | last post by:
hi I use to work with mysql but now I need mssql. Can somebody tell my how I canwork around LIMIT to select a number of records so I can display 10 records at a time in stead of all? Thanks
1
1950
by: dfw1417 | last post by:
I have used a query and report filter to return records related to a specific account id. I want to print a report including only the latest 6 records out of the set returned by the record filter. I...
0
6899
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7019
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6719
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6847
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5312
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4463
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2970
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
555
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.