scm22ri — 2012-11-17T13:00:21-05:00 — #1
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"
guido2004 — 2012-11-17T13:30:42-05:00 — #2
Here you can read about joins.
If you post the query you've got, we can see where you're going wrong.
scm22ri — 2012-11-17T14:16:35-05:00 — #3
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
squeal — 2012-11-18T05:41:10-05:00 — #4
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;