Results 1 to 3 of 3
  1. #1
    krazymonkeys is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Posts
    1

    querying for records that are identical except for one field

    Hi, please forgive me if I am asking something already answered. I am not even entirely sure of a proper title for what I am asking. I am a student with no prior experience with access and I haven't been able to get in touch with my instructor today. Basically, what I am looking at is I have a few entries I have to query for involving books with multiple authors. I can find which books have multiple authors as well as the second listed author, but I can't figure out how to get both authors to show up. The authors sequence is listed in the field "sequence" and the first author will have 1 as the entry and second will have 2. I get it to show the books with 2 authors by querying for sequence 2, but I can't figure out how to get it to show the same book's first sequence as well. I am guessing I should instead be somehow querying for duplicate entries in the title field but I haven't been able to figure that out either. I tried using the query wizard to search for duplicate entries, but being that the entries are not technically duplicate since the sequence field is different between the two, that type of query brings up no results at all. Please forgive me for coming here for this info, but I have been working on this question for a couple hours now and the homework is due tomorrow. Hopefully I'll get a response and in the mean time I'll keep trying. Thanks in advance.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    Please show us
    - the sql of your query, and
    - the design of your tables.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Here is one possibility, something like:
    SELECT * FROM table WHERE DCount("title","table","title='" & [title] & "'") > 1;
    or
    SELECT * FROM table WHERE DMax("sequence","table","title='" & [title] & "'") > 1;

    Another involves aggregate query and joining table/query.
    SELECT title, Count(title) As TitleCount FROM table GROUP BY title;
    Now join that query to the table on the title fields and apply >1 criteria to the TitleCount field, like:
    SELECT table.title, author FROM query1 INNER JOIN table ON query1.title = table.title WHERE TitleCount > 1;
    The above as single nested query
    SELECT table.title, author FROM (SELECT title, Count(title) As TitleCount FROM table GROUP BY title) As Query1 INNER JOIN Table ON query1.title=table.title WHERE TitleCount > 1;

    Shooting from hip but hope it gives you guidance.
    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. Querying All Data When Form Field Is Blank
    By jre1229 in forum Queries
    Replies: 25
    Last Post: 08-22-2012, 11:32 AM
  2. Active & Archive Tables Identical but Different?
    By Instructor Support in forum Database Design
    Replies: 1
    Last Post: 08-17-2012, 12:27 AM
  3. Filtering/Querying Records using Selection Screen
    By Jonny333 in forum Programming
    Replies: 1
    Last Post: 12-22-2011, 08:56 PM
  4. Identical record in a Listbox
    By mar_t in forum Access
    Replies: 4
    Last Post: 05-26-2011, 08:30 PM
  5. Difference between 2 identical tables.
    By leepan2008 in forum Access
    Replies: 1
    Last Post: 09-28-2009, 07:36 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