Results 1 to 2 of 2
  1. #1
    natasha_l is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    1

    Create query that copies fields X number of times from both tables?

    I imported two excel files to Access. One file has a list of product numbers (no duplicates), one file has a list of organization codes (no duplicates). I want to create a query that extracts the fields from my two new tables, so that each product number is then listed next to one organization code.


    e.g.
    1111 AAA
    1111 BBB
    1111 CCC
    2222 AAA
    2222 BBB
    2222 CCC

    Can I create a sql query for this in Access? I've played around with Access a bit, but I'm stuck. Basically I need to copy/insert fields. I know basic sql syntax, but I've only ever written my own statements from scratch when extracting raw data from one table. Should I combine the two lists into one table first? I thought I could do this with VBA in Excel, but I got stuck quickly, and someone mentioned that Access can easily perform this task.
    Thanks for any advice.

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Here is a query that will do that:

    SELECT Table11.Product, Table12.Organization
    FROM Table11, Table12;

    This takes all of the products and all of the organizations and creates records. Both tables will be duplicated in this query so that the number of records that result from this will be count of table 11 plus count of table 12.

    (In case you don't know what to do, go to Create > Query Design > SQL View, then copy and paste this changing the names as applicable)

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

Similar Threads

  1. Replies: 14
    Last Post: 02-23-2012, 06:32 PM
  2. Replies: 12
    Last Post: 12-17-2010, 05:35 PM
  3. Replies: 10
    Last Post: 12-15-2010, 11:12 AM
  4. Replies: 3
    Last Post: 08-24-2010, 07:40 PM
  5. Replies: 2
    Last Post: 06-22-2010, 07:09 AM

Tags for this Thread

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