Results 1 to 6 of 6
  1. #1
    silverxx12 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    18

    inner join question

    Hi I have two tables with names and amounts

    Table 1 - contains a whole range of names
    Table 2 - contains ONLY some of the names ON TABLE 1

    i created an inner join between the names on both of these table as i need the amounts from tble 1 with the names of table 2



    Is it possible to also get a list of names and amounts from table 1 which DO NOT APPEAR IN TABLE 2

    this was code used to find the similar names on tbl 2 with amounts from tbl1

    SELECT tbl2name, tbl1Amount
    FROM list2 INNER JOIN list1 ON tbl2name = tbl1name;

  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,848
    Research Left Join. You could also try the UNMATCHED query wizard in Access.

  3. #3
    silverxx12 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    18
    tried the left join and right join

    SELECT tbl1.Name, tbl1.Amount
    FROM tbl1
    LEFT JOIN tbl2
    ON tbl1.Name = tbl2.Name

    the left join outputted all the names

    the right join (just replaced word left join above ) returned all the names in table 2 which apeared on tabl 1

    unless i did something wrong ?

    Unmatched - really cool feature totally overlooked that - it did the job

    But just for future reference did i do anything wrong on the joins ?





  4. #4
    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,848

  5. #5
    silverxx12 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    18
    yes thanx much appreciated

    i had left the is null expression out in my first left join hence i was returning everything

    once i used the unmatched wizard which put that code in i could see where i was going wrong

    many thanks for the help leanrnt a good many tricks

  6. #6
    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,848
    Glad to help

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

Similar Threads

  1. Many-to-Many Self Join
    By neo651 in forum Access
    Replies: 4
    Last Post: 09-20-2012, 02:25 PM
  2. Outer Join Nested in Inner Join
    By Stevens7 in forum Queries
    Replies: 2
    Last Post: 10-19-2011, 01:34 PM
  3. SQL - Inner Join
    By springboardjg in forum Queries
    Replies: 1
    Last Post: 05-12-2011, 05:10 AM
  4. Help with right join
    By usa_dreamer2002 in forum Queries
    Replies: 3
    Last Post: 02-25-2011, 04:47 PM
  5. Interesting and Urgent Join Query Question
    By pinecrest515 in forum Queries
    Replies: 8
    Last Post: 01-26-2011, 11:21 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