Okay, I’ve got a stored procedure… how do I find all rows whose ID’s are not in an array? (Keep in mind that I’m using a PostgreSQL array that is created dynamically when the stored procedure is created
Example:
| people |
-------------
| id | Name |
-------------
| 1 | Bob |
| 2 | Te |
| 3 | Jack |
| 4 | John |
The array has somePGArray := [1,3], so a psuedo-query would look like this:
SELECT * FROM people WHERE id NOT IN (somePGArray)
Resulting query:
| people |
-------------
| id | Name |
-------------
| 2 | Te |
| 4 | John |
As a bonus, I also have no idea how to create an array and append ID’s to it, so if you have a quick hint how to do that, that’d be tremendously helpful. 🙂
1 Answer