2
I am creating a select where I need to check in one of the columns that is of type integer[] if it has one of the values passed in the condition.
for example:
idTarefa | Setores
1 | {1,3,4}
2 | {2}
Knowing that the column Sectors is integer[] (array), how can I make a select asking it to check if in this column there is the value of another array.
I’ve tried to do it this way:
select * from tarefas WHERE IN(ARRAY[2,4])
Thanks for your help.
Really @Guilherme this way
SELECT * FROM tb_tarefas WHERE 2 = ANY (Setores);
He returns the tasks to me, but if I have more than one number to check how I proceed? Because I have to pass an array of Sectors to check if in that task there are any of these sectors.– David Santos
William thank you for your help, worked for me the examples you gave me, just could not do the last. Now I’ll just sort out how I do it in an easy way to check if the values within one array exist within another. Again Thank you!
– David Santos