I have a databse with three tables. shirts, colors, and shirtcolors. Shirtcolors has 2 fields for the primary keys for both shirts and colors, linking up shirts and what colors thet come in...
my customers are going to be selecting a color from a pulldown and I want to have a search results page display all the shirts that have that color...
I have never pulled data from 2 tables before...what's the best way to do this????
Join tables queries are confusing???
1 reply to this topic
Posted 28 August 2006 - 09:41 PM
[code]Use a join... http://dev.mysql.com/doc/refman/5.0/en/join.html [/code]SELECT * FROM shirtcolors LEFT JOIN colors ON shirtcolors.color_id = colors.color_id LEFT JOIN shirts ON shirtcolors.shirt_id = shirts.shirt_id WHERE color = 'Blue';
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users