skaterdav85 Posted August 27, 2010 Share Posted August 27, 2010 I have 2 tables. Table 1 has the following fields:skateboard_name, wheel1ID, wheel2ID, wheel3ID, wheel4ID.and Table 2 called "Wheels" contains the fields:wheel_ID, brand, bearingEach wheelID in Table 1 relates to the wheel_ID field in Table 2. How would I construct a query that pulls the brand, so my results would look something like this?skateboard_name, brand (for wheel1ID), brand (for wheel2ID), brand (for wheel3ID), brand (for wheel4ID) Link to comment Share on other sites More sharing options...
justsomeguy Posted August 27, 2010 Share Posted August 27, 2010 You need to use a join, actually you'll need one join per wheel field. Look up using inner joins with table aliases, e.g.:SELECT s.skateboard_name, w1.brand, w2.brand, w3.brand, w4.brand FROM skateboards AS s INNER JOIN wheels AS w1 ... Link to comment Share on other sites More sharing options...
skaterdav85 Posted August 27, 2010 Author Share Posted August 27, 2010 awesome thanks. that worked! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.