I
Ivan Debono
Hi all,
I have a typical product ordering db with 3 tables (orders, products and
orders_products... all self-explanatory!!)
Now I need to create a query that brings back all orders that have, for
example, product 1 AND product 2.
The problem is that after doing the joins and I add the where clause like:
WHERE (products.id = 1 AND products.id = 2) then it finds nothing. And if I
do: WHERE (product.id = 1 OR products.id = 2) then it brings all orders that
have products 1 or 2, even though some orders don't have both products.
Any ideas to implement this?
Thanks,
Ivan
I have a typical product ordering db with 3 tables (orders, products and
orders_products... all self-explanatory!!)
Now I need to create a query that brings back all orders that have, for
example, product 1 AND product 2.
The problem is that after doing the joins and I add the where clause like:
WHERE (products.id = 1 AND products.id = 2) then it finds nothing. And if I
do: WHERE (product.id = 1 OR products.id = 2) then it brings all orders that
have products 1 or 2, even though some orders don't have both products.
Any ideas to implement this?
Thanks,
Ivan