Hi,
Say I want to do a query to look up all products (and their info) that meet certain criteria in the Sales table. I would write it:
But what if I want to match the subquery with the productId and the colorId. What is the right syntax for something like the following:
Is this even possible or do I have to do a join instead?
Many thanks in advance.
Regards,
Min
Say I want to do a query to look up all products (and their info) that meet certain criteria in the Sales table. I would write it:
Code:
select *
from product
where productId in
(select productId from Sales where <Condition>)
But what if I want to match the subquery with the productId and the colorId. What is the right syntax for something like the following:
Code:
select *
from product
where (productId, colorId) in
(select productId, colorId from Sales where <Condition>)
Is this even possible or do I have to do a join instead?
Many thanks in advance.
Regards,
Min