{"id":590,"date":"2019-05-20T04:21:34","date_gmt":"2019-05-20T04:21:34","guid":{"rendered":"http:\/\/angelwings.net\/blog\/?p=590"},"modified":"2019-05-20T04:21:34","modified_gmt":"2019-05-20T04:21:34","slug":"prestashop-searching-orders-by-the-products-they-contain-via-mysql","status":"publish","type":"post","link":"https:\/\/angelwings.net\/blog\/prestashop-searching-orders-by-the-products-they-contain-via-mysql\/","title":{"rendered":"Prestashop: Searching orders by the products they contain via mysql"},"content":{"rendered":"<p>Source: https:\/\/www.prestashop.com\/forums\/topic\/437518-searching-orders-by-the-products-they-contain\/?tab=comments#comment-2033625<\/p>\n<p>SELECT product_id, product_attribute_id, product_name, GROUP_CONCAT(id_order SEPARATOR &#8216;, &#8216;) AS orders FROM ps_order_detail group by product_name order by product_id, product_attribute_id<\/p>\n<p>Can add where product_id = to the number you want to narrow down the specific product<\/p>\n<p>SELECT product_id, product_attribute_id, product_name, GROUP_CONCAT(id_order SEPARATOR &#8216;, &#8216;) AS orders FROM ps_order_detail <strong>where product_id = XYZ<\/strong> group by product_name order by product_id, product_attribute_id<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source: https:\/\/www.prestashop.com\/forums\/topic\/437518-searching-orders-by-the-products-they-contain\/?tab=comments#comment-2033625 SELECT product_id, product_attribute_id, product_name, GROUP_CONCAT(id_order SEPARATOR &#8216;, &#8216;) AS orders FROM ps_order_detail group by product_name order by product_id, product_attribute_id Can add where product_id = to the number you want to narrow down the specific product SELECT product_id, product_attribute_id, product_name, GROUP_CONCAT(id_order SEPARATOR &#8216;, &#8216;) AS orders FROM ps_order_detail where product_id = XYZ group by [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[89,103,105],"class_list":["post-590","post","type-post","status-publish","format-standard","hentry","category-database","tag-mysql","tag-prestashop","tag-prestashop-1-6"],"_links":{"self":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts\/590","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/comments?post=590"}],"version-history":[{"count":0,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts\/590\/revisions"}],"wp:attachment":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/media?parent=590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/categories?post=590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/tags?post=590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}