This itertools example compares only 1 item to another. I need to compare 1 item to 2 others at the same time.
my_list = [10, 420, 11]
I need to be able to compare these items in the query below, with the following comparisons:
- 10 to both 420 and 11 (as in the code below),
- 420 to both 10 and 11,
- 11 to both 420 and 10.
I'm running this inside of a SQL query.
SELECT COUNT(*) FROM (
SELECT app FROM vendor WHERE vendor=10 AND active
INTERSECT
SELECT app FROM vendor WHERE vendor NOT IN (420, 11) AND active = 0
)