IN POSTGRESQL:
Say I have a table of Users and I do:
SELECT "EyeColor" FROM "Users" WHERE "Age" = 32
And this returns:
[
{"EyeColor": "blue"},
{"EyeColor": "green"},
{"EyeColor": "blue"}
]
Then I want to put blue, green, blue into an array and use that. This is the closest I can get but it is not working:
SELECT * FROM "Eyes" WHERE "Color" IN
(SELECT array_agg("EyeColor") FROM "Users" WHERE "Age" = 32)
I want the anpve query to work the same as this:
SELECT * FROM "Eyes" WHERE "Color" IN ('blue', 'green')