cmgmyr Posted May 8, 2008 Share Posted May 8, 2008 Hey All, I have a little delema that I can't figure out. I have this query currently: SELECT p.id, p.styleno, t1.name AS category1, t2.name as category2, t3.name as category3, p.description, p.price, p.sort FROM categories AS t1 LEFT JOIN categories AS t2 ON t2.parentid = t1.id LEFT JOIN categories AS t3 ON t3.parentid = t2.id INNER JOIN products AS p ON t3.id = p.category Now, this works great if there are 3 levels of categories, but I need this to be altered to show all of the items if there are 1, 2, or 3 levels of categories...and not just 3. Any ideas? Thanks in advance, -Chris Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.