Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sql to build categories menu that have products
- select c1.*, c2.* from categories c1, categories c2, products_categories pc where c1.category_id = c2.parent_id and pc_category_id = c1.category_id;
- SELECT tb1.* FROM categories AS tb1 JOIN products_categories AS tb2 ON tb1.category_id=tb2.category_id AND tb2.product_id IN (SELECT tb3.product_id FROM products AS tb3 JOIN products_categories AS tb4 ON tb3.product_id=tb4.product_id WHERE tb3.product_id=tb2.product_id)
Add Comment
Please, Sign In to add comment