How would I go about joining 3 tables at once? My database design/setup is at the below URL. I want the mysql statement to say "1992 Ford Explorer"
Here you can read about joins.
If you post the query you've got, we can see where you're going wrong.
Thanks for the reply. I'm reading your link currently.
These are my sql commands. Please advise.
SELECT car_years.name, car_makes.name
FROM car_makes, car_years
SELECT car_makes.name, car_models.name
FROM car_makes, car_models
SELECT car_years.name, car_models.name
FROM car_years, car_models
WHERE car_years.id = car_year_id
SELECT years.name, models.name
FROM car_years AS years, car_models AS models
WHERE years.id = car_year_id
If you're joining on something called year_id, I think something's gone very wrong!
I would expect to see something more along these lines
models(make_id*,model_id*,model) [also (`make_id`,`model`) should be unique]
* = PRIMARY KEY (or component thereof)
FROM makes k
JOIN models d
ON d.make_id = k.make_id
JOIN model_year y
ON y.model_id = d.model_id;
This topic is now closed. New replies are no longer allowed.