2

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?

Jochen Schwarze
  • 292
  • 6
  • 27

1 Answers1

3

with intarray extension installed, one may simply select a-b, cp. https://www.postgresql.org/docs/current/static/intarray.html

Jochen Schwarze
  • 292
  • 6
  • 27