I have 3 tables: products, orders and orderLines(order_id, product_id).
I have an sql query to figure out which seems nearly impossible to do in only one query
.
Is there a way to have in only one query:
- All the products but showning a specific order's products first;
which means that: for an
order A
: showproduct1
,product2
.. present inorderA's orderLines
first, than thefollowing products
(not ordered) are shown next.
PS:
I know it's possible to achieve this with a union
of two queries, but it would be better to have it done in only one query
.