Results 1 to 5 of 5
  1. #1
    markusw is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    2

    Question More than one join

    Hi all!



    I have two tables:

    Flights
    FlightID, From, To
    1, TYO, SIN
    2, LHR, JFK

    Airports
    AirportID, IATAcode, City
    1, TYO, Tokyo
    2, SIN, Singapore
    3, LHR, London
    4, JFK, New York

    I wish to create a query which looks like this:

    FlightID, From, FromCity, To, ToCity

    I know how to make a join so that I get the city name from the Airports-table, but can somebody point me in the right direction on how to be able to do two joins to the same table? Or solving this in another way.

    Thanks!

    markus

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    Bring down Airports table twice...

    select * from Flights,
    Airports, Airports as Airports_1

    join
    Airports.airportID to
    Flights.FROM
    Airports_1.airportID to Flights.TO


  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,944
    Just pull the Airports table into the query designer window twice and click drag between fields to set link lines - delete line that may have been automatically set for the second instance of table.
    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.

  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,728
    Your relationships:
    Code:
       
    Flights                 Airports           SecondCopyof Airports
    
    To------------------ITACode
                          City
    
    From -------------------------------------- ITACode
                                                   City

  5. #5
    markusw is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    2
    Thanks a lot guys and girls! Worked!

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

Similar Threads

  1. Replies: 6
    Last Post: 11-19-2013, 01:38 AM
  2. Inner Join works but not Left Join
    By kwooten in forum Queries
    Replies: 1
    Last Post: 12-11-2012, 05:09 PM
  3. Many-to-Many Self Join
    By neo651 in forum Access
    Replies: 4
    Last Post: 09-20-2012, 02:25 PM
  4. Outer Join Nested in Inner Join
    By Stevens7 in forum Queries
    Replies: 2
    Last Post: 10-19-2011, 01:34 PM
  5. SQL - Inner Join
    By springboardjg in forum Queries
    Replies: 1
    Last Post: 05-12-2011, 05:10 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