PostgreSQL table with two integer array columns, say a = [1,2,3,4]
and b = [1,2,3,4,5,6]
. The items of b
that are not in a
are 5,6
, so as a query result I want an array [5,6]
.
How to achieve this in PostgreSQL?
PostgreSQL table with two integer array columns, say a = [1,2,3,4]
and b = [1,2,3,4,5,6]
. The items of b
that are not in a
are 5,6
, so as a query result I want an array [5,6]
.
How to achieve this in PostgreSQL?
with intarray
extension installed, one may simply select a-b
, cp. https://www.postgresql.org/docs/current/static/intarray.html