Results 1 to 6 of 6
  1. #1
    scorpio is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    11

    Copying a column from one query/table to another within the same database

    I have two sets of data in queries with an inner join on the ID number only.



    These are the fields in the two queries.

    Query A Query B Query B Date
    ID Number ID Number Date
    12345 12345 1/1/12
    12345 1/2/12
    12345 1/3/12

    I would like the data from Query A and Query B that have the same ID Number. So I want my results to look like below. The results should only return one field because there is only 1 field in table A.
    ID Number Date
    12345 1/1/12


    However, the query is pulling the ID number from query A and all of the fields from query B that because they all match query A creating duplicate data. For example:

    ID Number 12345 Date 1/1/12
    ID Number 12345 Date 1/2/12
    ID Number 12345 Date 1/3/12

    Is there a way for me to put the date field in table A? so that way I can query and join the data using the ID # and the date so the results will only show that one record that is in that is in table A with the correspoding record in Table B? I am unable to just copy and past because there is no way for me to query data between the 2 except for ID #.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Not understanding.

    ID Number is unique in QueryA?

    There are multiple records for each ID Number in QueryB?

    Why do you want only 1/1/12 to show?
    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.

  3. #3
    scorpio is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    11
    No ID # is not unique in either table. I only want that exact record from table A that's why I only want to show 1/1/12 from table B. I don't want the field from table B to duplicate my results in table A. Yes there are multiple records for ID #s in both tables. But If table A has one record for ID I don't want it to pull 3 records from table B with the same ID #. How do I prevent this? I have an aggregate query that groups the appropriate fields but it still creates multiple records in results of my inner join query between table A & table B

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Do a query for each table that pulls only the desired single record for each ID Number. Then join the two queries.

    Do you want all fields to be returned?

    Why should 1/1/12 be the date returned? Why not 1/3/12? What is the rule for filtering?
    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.

  5. #5
    scorpio is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    11
    That's the problem there isn't one. I'm just going to run a duplicate query & delete the records I don't want. Thanks for your help

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The rule could be latest date or earliest date.

    On what basis will be decision to delete? That is the rule to apply in query.
    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: 4
    Last Post: 09-04-2013, 06:40 AM
  2. Copying fields includes column name
    By julioot in forum Access
    Replies: 14
    Last Post: 04-04-2012, 08:25 AM
  3. Replies: 1
    Last Post: 12-16-2011, 08:16 AM
  4. Replies: 5
    Last Post: 12-08-2011, 10:52 AM
  5. Keep From Copying Database
    By jmyersnc in forum Programming
    Replies: 2
    Last Post: 02-07-2010, 07:44 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