I'm trying to make a SQL query, but I can't figure out how it works. (I have learned to handle HTML, CSS, PHP, etc., but have never understood SQL)
What I want to achieve is a list with the following content:
name of supplier - product name - product reference - product qty
There should be an option to enter the order id so that I get the list for a couple of orders combined, grouped by article and sorted by supplier.
My foolish try ended as follows, of course with nor result.
SELECT
s.name AS supplier,
od.product_name AS product,
od.product_reference AS sku,
od.product_quantity AS qty,
FROM `ps_order_detail` od
LEFT JOIN `ps_order_detail` od ON o.`id_order` = od.`id_order`
LEFT JOIN `ps_supplier` od ON s.`product_reference` = od.`product_reference``
GROUP BY od.`product_name`
SORT BY s.name ASC
WHERE od.`id_order` =1166,1167,