Jun 22 2008, 01:46 PM
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.
Jun 22 2008, 01:52 PM
SELECT Reservation.ReservationID, Reservation.DepartureTime, Reservation.FlightNumber, Airline.AirlineName
FROM Airline INNER JOIN Reservation ON Airline.AirlineCode = Reservation.Airline;
Hope that helps!
Jun 22 2008, 01:54 PM
Your query could look something like this in SQL view:
SELECT Reservations.ReservationID, Airlines.AirlineName, Reservations.DepartureTime, Reservations.FlightNumber
INNER JOIN Airlines
ON Reservations.Airline = Airlines.AirlineCode
Hope that helps...
Oops, a little slow today. Sorry for the duplicate info.
Edited by: theDBguy on Sun Jun 22 14:55:43 EDT 2008.
Jun 23 2008, 05:27 AM
Worked perfectly. Thanks!
Jun 23 2008, 09:39 PM
You're welcome. demtron and I are happy to help. Good luck with your project.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here