Quote:
Originally Posted by k0nr4d
You would insert multiple models_cities entries per model.
So lets say Toronto = 123
Chicago = 456
New York = 789
INSERT INTO models_cities (model, city) VALUES (modelid,123);
INSERT INTO models_cities (model, city) VALUES (modelid,456);
INSERT INTO models_cities (model, city) VALUES (modelid,789);
SELECT model.* FROM model WHERE model.model_id = model_in_city.model_id AND model_in_city.city_id = city.city_id AND city.city_name = "Toronto"
SELECT model.* FROM model WHERE model.model_id = model_in_city.model_id AND model_in_city.city_id = city.city_id AND city.city_name = "Chicago"
SELECT model.* FROM model WHERE model.model_id = model_in_city.model_id AND model_in_city.city_id = city.city_id AND city.city_name = "New York"
Will then all return the same model
Edit: well, insert using your actual table and column names i just wrote those inserts quickly to show you.
|
Ah thanks bro. I'll try this tonight or tomorrow. I was thinking along the lines of:
VALUES (modelid, 123, 456, 789, ...);
Which you can't do from my understanding (multiple values in column). I searched google and my book for reference but couldn't find anything on this. Thanks again!