UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Table Lookup In Query...    
 
   
AdamL
post Jun 22 2008, 01:46 PM
Post #1

UtterAccess Addict
Posts: 113
From: New York, NY



I have a table called Airlines with the following fields:

AirlineID - Primary Key
AirlineCode - Two Digit Code for the Airline
AirlineName - Full Airline Name

I have a second table called Reservations with the following fields:

ReservationID - Primary Key
Airline - Airline stored as the Two Digit Code from the table above
DepartureTime - Departure time (irrelevant for this question)
FlightNumber - Flight Number (irrelevant for this question)

The Airline Code is stored in the second table called Reservations as the two digit code. (Ex. JetBlue = JB) I want to create a query of the Reservations table but I want to have the Query return the full name of the Airline, (Ex. JetBlue) not the Airline Code (Ex. JB) as stored in the Reservations table. Any suggestions would be greatly appriciated. Thanks.

Adam
Go to the top of the page
 
+
demtron
post Jun 22 2008, 01:52 PM
Post #2

UtterAccess Enthusiast
Posts: 64
From: Wisconsin, US



Try this...

SELECT Reservation.ReservationID, Reservation.DepartureTime, Reservation.FlightNumber, Airline.AirlineName
FROM Airline INNER JOIN Reservation ON Airline.AirlineCode = Reservation.Airline;

Hope that helps!
Go to the top of the page
 
+
theDBguy
post Jun 22 2008, 01:54 PM
Post #3

Access Wiki and Forums Moderator
Posts: 47,962
From: SoCal, USA



Your query could look something like this in SQL view:

SELECT Reservations.ReservationID, Airlines.AirlineName, Reservations.DepartureTime, Reservations.FlightNumber
FROM Reservations
INNER JOIN Airlines
ON Reservations.Airline = Airlines.AirlineCode

Hope that helps...

Edit Added:

Oops, a little slow today. Sorry for the duplicate info.

Edited by: theDBguy on Sun Jun 22 14:55:43 EDT 2008.
Go to the top of the page
 
+
AdamL
post Jun 23 2008, 05:27 AM
Post #4

UtterAccess Addict
Posts: 113
From: New York, NY



Worked perfectly. Thanks!

Adam
Go to the top of the page
 
+
theDBguy
post Jun 23 2008, 09:39 PM
Post #5

Access Wiki and Forums Moderator
Posts: 47,962
From: SoCal, USA



You're welcome. demtron and I are happy to help. Good luck with your project.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 02:15 AM