postgres - comparing two arrays

后端 未结 2 528
情书的邮戳
情书的邮戳 2021-01-01 12:58

postgres has an array data type, in this case a numeric array:

CREATE TABLE sal_emp (name text, pay_by_quarter integer[]);
INSERT INTO sal_emp VALUES (\'one\         


        
2条回答
  •  [愿得一人]
    2021-01-01 14:03

    Trying not to plagiarise pstanton's answer, but clarifying a use case.

    To have a condition that is satisfied by any of two (or more) columns having any of a list of values:

     select * from mytable
     where array(col1, col2) && array('foo', 'bar', baz')
    

提交回复
热议问题