lemmin Posted October 1, 2007 Share Posted October 1, 2007 I have a table that looks something like this: CatID SuperCatID 1 2 3 4 1 5 1 6 2 7 3 8 3 Another table uses the CatID. How can I get everything from either CatID or SuperCatID depending on the CatID. For example, if the CatID is 1, I want everything in the other table that has a CatID of 1,4 or 5. Thanks for any help. Quote Link to comment https://forums.phpfreaks.com/topic/71440-query-help/ Share on other sites More sharing options...
Barand Posted October 1, 2007 Share Posted October 1, 2007 SELECT t.* FROM othertable t INNER JOIN atable c1 ON t.CatID = c1.CatID LEFT JOIN atable c2 ON c1.SuperCatID = c2.CatID WHERE c2.CatID = 1 OR c1.CatID = 1 Quote Link to comment https://forums.phpfreaks.com/topic/71440-query-help/#findComment-359664 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.