Compare arrays for equality, ignoring order of elements

后端 未结 5 2075
既然无缘
既然无缘 2020-11-29 11:14

I have a table with 4 array columns.. the results are like:

ids       signed_ids   new_ids   new_ids_signed
{1,2,3} | {2,1,3}    | {4,5,6} | {6,5,4}
<         


        
5条回答
  •  情书的邮戳
    2020-11-29 11:43

    select (string_agg(a,',' order by a) = string_agg(b,',' order by b)) from (select unnest(array[1,2,3,2])::text as a,unnest(array[2,2,3,1])::text as b) A

提交回复
热议问题