How to compare two arrays and pick only the non matching elements In postgres

后端 未结 7 1985
一整个雨季
一整个雨季 2020-12-14 06:15

How can I pick only the non matching elements between two arrays.

Example:

base_array [12,3,5,7,8]
temp_array [3,7,8]

So here I wan

7条回答
  •  生来不讨喜
    2020-12-14 06:58

    select array_agg(elements)
    from (
      select unnest(array[12,3,5,7,8])
      except
      select unnest(array[3,7,8])
    ) t (elements)
    

提交回复
热议问题