B
B
Bogdan2017-07-24 17:31:25
PostgreSQL
Bogdan, 2017-07-24 17:31:25

How to find output a list of all not found values ​​from an array?

Hello. Tell me please. There is a directory, and you need to select those records that are in the array. And also somehow display those values ​​that are in the array, but not in the table.

select * from children where code in 
(select unnest(ARRAY['000000002', '000000012', '000000013','000000014','000000015','000000016','000000017' ]))

Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2017-07-24
@bogdan_uman

select children.code is null as is_not_found, /*another children data is null too*/ 
from unnest(array[...]) as code 
left join children using(code)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question