nick4share Posted August 19, 2021 Share Posted August 19, 2021 Hi. I was looking for, but didn't find a solution and I decided to create a new topic. I need a SQL query to export categories tree. Finally I will need something like this: product_id,categories 1,Clothes/Men/Trousers;Bestsellers 2,Clothes/Women/Dresses/Casual;Promotion Is it possible? Someone with good SQL skills can help me? Before I found only query like this below, but it isn't solve in my case. SELECT p.id_product, pl.name AS 'Name', GROUP_CONCAT(DISTINCT(cl.name) SEPARATOR ',') AS 'Categories (x,y,z...)' FROM ps_product p LEFT JOIN ps_product_lang pl ON(p.id_product = pl.id_product) LEFT JOIN ps_category_product cp ON(p.id_product = cp.id_product) LEFT JOIN ps_category_lang cl ON(cp.id_category = cl.id_category) GROUP BY p.id_product; Thanks in advance for your help! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now