SQL - logical AND among multiple rows
Posted
by potrnd
on Stack Overflow
See other posts from Stack Overflow
or by potrnd
Published on 2010-05-04T18:18:55Z
Indexed on
2010/05/04
18:28 UTC
Read the original article
Hit count: 137
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
© Stack Overflow or respective owner