Good morning! I'm having a hard time and I'd like your help with this problem!
Now, I'm doing a select in MYSQL where multiple tables are selected, in opencart to generate an XML for facebook ads.
My XML is like this
SELECT DISTINCT t1.product_id as product_idT1, t1.manufacturer_id as manufaturer, t1.price as price, t1.date_added as dataAdd, t1.quantity as quantity, t2.name as nameT2, t2.description as descriptionT2, t3.name as nameT3, t4.name as nameT4, t5.image, t6.name as nameT6, t7.query as urlT7, t7.keyword as keyword
FROM oc_product t1
INNER JOIN oc_product_description t2 ON (t1.product_id = t2.product_id)
INNER JOIN oc_manufacturer t3 ON (t1.manufacturer_id = t3.manufacturer_id)
INNER JOIN oc_option_value_description t4
INNER JOIN oc_product_image t5 ON (t1.product_id = t5.product_id)
INNER JOIN oc_stock_status t6 ON (t1.stock_status_id = t6.stock_status_id)
INNER JOIN oc_url_alias t7
WHERE t7.query like CONCAT('%', t1.product_id , '%')
GROUP BY product_idT1 ASC
In this case, the image table oc_product_image must be in DECREASE order because I want the last image.
I'm using PHP.
Thank you!