I’m trying to advance my knowledge of mysql from “I can make it work” to “I can make it work correctly”. I’m working with joins right now and I was wondering the best way of doing the following:
I have 2 tables “items” and “categories”. Inside the “items” table I have a field called category which will be linked to the “categories” table primary key cid. What is the best way of doing this? This is how I’ve always done it but I feel it’s not the best way by any means
SELECT C.something, C.soemthing 2 FROM categories C, items I WHERE C.cid=I.category AND C.categoryName='New'
Your query is already correct but I’ll recommend to use
ANSI SQL-92formatquestion, what are you trying to achieve?