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
WHERE car_years.id=car_year_id
year, make
>>>>>>>
SELECT car_makes.name, car_models.name
FROM car_makes, car_models
WHERE car_makes.id=car_make_id
make, model
>>>>>>>>
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
year, model
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
makes(make_id*,make)
models(make_id*,model_id*,model) [also (`make_id`,`model`) should be unique]
model_year(model_id*,year*)
* = PRIMARY KEY (or component thereof)
SELECT k.make
, d.model
, y.year
FROM makes k
JOIN models d
ON d.make_id = k.make_id
JOIN model_year y
ON y.model_id = d.model_id;