Hey please I need help with a MYSQL query if you could please read on ill include almost everything you need.
Note: I have read multiple answers before I post but i'm not sure if these answers sort my issue.
The Query i'm using:
SELECT
t1.name AS product_name,
t1.description AS product_description,
GROUP_CONCAT(t2.name) AS category
FROM cdxc_product_description t1 INNER JOIN
cdxc_product_to_category t3
ON t3.product_id = t1.product_id INNER JOIN
cdxc_category_description t2
ON t2.category_id = t3.category_id
GROUP BY t1.name, t1.description;
The result I get:
product_name | product_description | product_category
-----------------------------------------------------------
NAME 1 | Description 1 | Cat1,Cat2,Cat5
NAME 2 | Description 2 | Cat7,Cat2,Cat1
Is there any way I could get a result like this?
product_name | description | category | category2 | category3
-----------------------------------------------------------
NAME 1 | Description 1 | Cat1 | Cat2 | Cat5
NAME 2 | Description 2 | Cat7 | Cat2 | Cat1
PLEASE NOTE: I do not want to make sql generate anything dynamically as I know it's not possible, i just want you to point me to the right direction to get the result mentioned done either via a totally different query with a different approach or by just a modification to my query.