Results 1 to 2 of 2
  1. #1
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476

    If I have a list of duplicate data in fields how can I only query the first Record?

    I have a query with 5-fields:



    - ZipCode
    - PostOffices
    - County
    - State
    - Map (Map#)

    * Now many ZipCodes/PostOffices are on more than 1-Map#. So, let’s say ZipCode/PostOffice ‘19001 Abington’ is on Map# ‘3258’ ‘3259’ ‘3370’ ‘3371’ & ‘3372.’ In my ZipCode Table/Query I’ll have 4-Records pertaining to ZipCode/PostOffice ‘19001 Abington.’

    I want to have another Query which just list ‘19001 Abington’ once as well as the other ZipCodesPostOfficess multi listings. Originally I had a YesNo field & checked off every first ZipCodePostOffice entry. Last night I thought that I could eliminate my YesNo field by creating another query with the fields; ‘ZipCode’, PostOffice’, ‘Co’, & ‘St.’ then, under ‘PostOffice’ in the Total Grid choose “first. This moring when I opened the query it didn’t work. Next I tried, “Min” & that didn’t work. If I have a list of duplicate data in fields how can I only query the first Record? Shouldn’t “First” or “Min” work?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    No, the First and Min aggregate functions just show the first or min value in that field for the entire recordset. In a GROUP BY query it would be the first or min value for the group.

    Try using the TOP qualifier in a subquery. Review http://allenbrowne.com/subquery-01.html
    Particularly the 'TOP n records per group' example.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 11-12-2012, 10:44 AM
  2. Replies: 8
    Last Post: 09-26-2012, 01:51 PM
  3. Replies: 6
    Last Post: 02-21-2012, 03:34 PM
  4. Replies: 3
    Last Post: 01-08-2011, 05:40 PM
  5. Duplicate data fields
    By watergal82 in forum Access
    Replies: 1
    Last Post: 09-07-2010, 02:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums