PDA

View Full Version : Solved: Trouble connecting tables



austenr
01-31-2012, 12:46 PM
Can someone please show me how to connect the tables in this test DB attachment correctly? Thanks.

austenr
01-31-2012, 01:09 PM
in case you dont want to open the attachment, here are the tables:

Item

itemID Auto increment
ItemName
description
categoryID

Category

categoryID Auto increment
CategoryName

ItemOrderMembership

orderID
itemID

My question is how to connect the orderID to the Category and Item tables. Would you use a left join on itemID from the Item table to join the itemID in the ItemOrderMembership table?

mohanvijay
01-31-2012, 08:45 PM
SELECT * FROM Item t0 INNER JOIN Category t1 ON t0.categoryID=t1.categoryID INNER JOIN ItemOrderMembership t2 on t0.itemID=t2.itemID

austenr
02-01-2012, 12:07 AM
thanks that got it.