Let's say I want to query the order number, product number, and quantity of any item in which the product number and quantity match both the product number and quantity of an item in ordid 365 AND the productCategory is "Electronics".
I've tried to do it as follows:
SELECT
ordid, prodid, qty
FROM
item
WHERE
((prodid, qty) IN (SELECT prodid, qty
FROM item
WHERE ordid = 365)
AND productCategory = "Electronics")
But I'm getting the following errors:
An expression of non-boolean type specified in a context where a condition is expected, near ','.
Incorrect syntax near the keyword 'and'.
Am I using the right T-SQL syntax to perform this kind of action?
Thanks in advance!