I'm using Postgres's native array type, and trying to find the records where the ID is not in the array recipient IDs.
I can find where they are IN:
SELECT COUNT(*) FROM "messages" WHERE (3 = ANY (recipient_ids))
But this doesn't work:
SELECT COUNT(*) FROM "messages" WHERE (3 != ANY (recipient_ids))
SELECT COUNT(*) FROM "messages" WHERE (3 = NOT ANY (recipient_ids))
what's the right way to test for this condition?
WHERE 3 NOT IN recipient_ids
work? – Janus Troelsen Jul 30 '12 at 22:45text[]
andint[]
array:select not(array[1,2,3] @> array[3]);
– Steve Peak Mar 29 at 13:47