Results 1 to 4 of 4
  1. #1
    usa_dreamer2002 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    4

    Help with right join

    Hi all,
    I have something similar to the following:

    TABLE1
    SVC CODE
    001 HV
    002 CH
    003 9Q
    007 NZ
    ...

    TABLE2
    SVC LOCATION
    001 SW


    002 NE
    007 NE
    ...

    im looking for something like this:

    SVC CODE LOCATION
    001 HV SW
    002 NE NE
    003 9Q NULL
    007 NZ NE

    I tried the following query and svc 003 is always excluded.

    SELECT SVC, CODE, LOCATION
    FROM TABLE1 RIGHT JOIN TABLE2
    ON TABLE1.SVC = TABLE2.SVC

    tried left, right joins and same result. Can any one give me some suggestion. In the real database. I have a report that pulls a list of services and I need to match them with another table that has some values. if the services are not performed on any given month, they are excluded and thereby being excluded in my query. However, I need to have them in a report for comparison purposes. I appreciate any input.

    Thanks in advance.

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Sadly, what you are looking for is a full outer join. SQL Server supports the FULL OUTER JOIN clause but Access doesn't. What you will have to do is run 3 separate queries to pull all cases (inner, left, right) and then a UNION query to pull it all together.

    http://www.databasejournal.com/featu...oft-Access.htm

  3. #3
    usa_dreamer2002 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    4
    Thanks for replying. I tried your example but no luck it doesnt pickup one of the values

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    so you had
    qry1
    SELECT *
    FROM table1 LEFT JOIN ....

    qry2
    SELECT *
    FROM table1 RIGHT JOIN ....

    qry3
    SELECT *
    FROM table1 INNER JOIN ....

    qry4
    SELECT *
    FROM qry1
    UNION
    SELECT *
    FROM qry2
    UNION
    SELECT *
    FROM qry3

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

Similar Threads

  1. Join Query?
    By KWarzala in forum Forms
    Replies: 5
    Last Post: 07-29-2014, 02:44 PM
  2. Help with something similar to join?
    By lagunov in forum Queries
    Replies: 7
    Last Post: 10-28-2010, 07:01 AM
  3. Problem with Join
    By sujitshukla in forum Queries
    Replies: 1
    Last Post: 08-26-2010, 07:25 AM
  4. JOIN Two Queries
    By rickn in forum Access
    Replies: 2
    Last Post: 07-12-2010, 02:42 PM
  5. WHERE as part of JOIN not after
    By thestappa in forum Queries
    Replies: 1
    Last Post: 05-14-2010, 10:52 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