View Single Post
Old 10-05-2012, 05:11 PM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Yep, and nope. That would be a join:
Code:
SELECT wfp.plane_name, ynt.destination
FROM yournewtable ynt
INNER JOIN wp_flr_planes wfp ON wfp.id = ynt.planeid
WHERE wfp.plane_name = 'This is the plane name'
I can't really suggest a good query since I don't know what all of your properties are, and I'm not sure how you intend to use it after. I see something like a booking, so a plane has a known name and number of seats, and is used in a booking to see a destination and date/time of departure/arrival, etc.

If you use INNODB database engine, then you can add constraints as well (that are enforced). So in the secondary table, you can specify that it's "planeid" must reference the id in the wp_flr_planes. If it doesn't exist, it will throw an error, and you can set up cascading for updates and deletes.
Fou-Lu is offline   Reply With Quote