postgres - comparing two arrays

后端 未结 2 1826
花落未央
花落未央 2021-01-01 13:34

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 13:54

    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')
    

提交回复
热议问题