Table A
itemNo colorNo
1 3
1 4
2 4
2 70
3 9
3 10
I wanted to do this...
SELECT *
FROM A
WHERE itemNo = '1' AND colorNo = '4';
SELECT *
FROM A
WHERE itemNo = '2' AND colorNo = '70';
SELECT *
FROM A
WHERE itemNo = '3' AND colorNo = '9';
But can I combine those 3 queries into one?
I tried to do this, but it only returned one row satisfying the last condition.
SELECT *
FROM A
WHERE ((itemNo = '1' AND colorNo = '4')
or (itemNo = '2' AND colorNo = '70')
or (itemNo = '3' AND colorNo = '9'));
EDIT: It turns out the table I got is faulty. The first two 'itemNo' didn't even exist! No wonder only the last one got returned. Thank you to everyone who helped! I'll leave this up here and hopefully it'll help someone with a similar question.