I hope you all having a nice day.
I am wondering is it possible to generate below feed with SQL on Magento 2 Database? I want to run this query from Google Apps scripts using jdbc:mysql.
Expected fields are:
----------------------------------------
| product_id | sku | name | categories |
----------------------------------------
I have tried this way but I don't know how to get product category names (including subcategories) not ids.
SELECT entity_id, GROUP_CONCAT(category_id) as category_ids FROM (
SELECT `e`.entity_id, `at_category_id`.`category_id`
FROM `catalog_product_entity` AS `e`
LEFT JOIN `catalog_category_product` AS `at_category_id`
ON (at_category_id.`product_id`=e.entity_id)
) sub_query
GROUP BY entity_id
Thanks :)
catalog_product_entity_varcharthis is because of the EAV pattern.