Results 1 to 3 of 3
  1. #1
    wellsw is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2013
    Posts
    7

    Unique Pairs

    I have a table with to: and from: locations as below
    to: from:
    chi stl
    det chi
    stl Chi

    What I need to do is create a list of unique pairs where chi stl is the same as stl chi. It doesn't matter which instance I keep only that they are unique pairs.


    Any Ideas would be greatly appreciated.

    Thanks

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I would create a query, where you sort the two entries on each line, and then do an Aggregate Query to weed out all the duplicates.

    Assuming your table name is "Table1" and your field names are "to" and "from", the SQL code of that query would look something like:
    Code:
    SELECT IIf([to]<[from],[to],[from]) AS Entry1, IIf([to]<[from],[from],[to]) AS Entry2
    FROM Table1
    GROUP BY IIf([to]<[from],[to],[from]), IIf([to]<[from],[from],[to]);

  3. #3
    wellsw is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2013
    Posts
    7
    Worked perfect.. thank you very much.

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

Similar Threads

  1. Comparing pairs of records in a query
    By lydonw in forum Queries
    Replies: 2
    Last Post: 08-17-2013, 12:30 AM
  2. Replies: 22
    Last Post: 03-03-2013, 02:00 PM
  3. Track Unique IDs
    By Newbie11 in forum Reports
    Replies: 5
    Last Post: 05-08-2012, 11:45 AM
  4. Unique queries - Unique Count
    By bigfish in forum Queries
    Replies: 7
    Last Post: 03-14-2012, 01:28 PM
  5. how to set a unique ID
    By archie in forum Access
    Replies: 1
    Last Post: 09-08-2009, 04:28 AM

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