SQL - logical AND among multiple rows
- by potrnd
Hello,
First of all sorry that I could not think of a more descriptive title.
What I want to do is the following using only SQL:
I have some lists of strings, list1, list2 and list3.
I have a dataset that contains two interesting columns, A and B. Column A contains a TransactionID and column B contains an ItemID.
Naturally, there can be multiple rows that share the same TransactionIDs.
I need to catch those transactions that have at least one item ID that exists whithin each list (list1, list2 AND list3).
I also need to count how many times does that happen for each transaction.
I hope that makes enough sense, perhaps I will be able to explain it better with a clear head.
Thanks in advance