How to make a select with array contains value clause in psql

后端 未结 3 1287
自闭症患者
自闭症患者 2020-11-29 20:14

I have column arr which is of type array.

I need to get rows, where arr column contains value s

This que

相关标签:
3条回答
  • 2020-11-29 20:52

    Note that this may also work:

    SELECT * FROM table WHERE s=ANY(array)
    
    0 讨论(0)
  • 2020-11-29 20:54

    Try

    SELECT * FROM table WHERE arr @> ARRAY['s']::varchar[]
    
    0 讨论(0)
  • 2020-11-29 20:54
    SELECT * FROM table WHERE arr && '{s}'::text[];
    

    Compare two arrays for containment.

    0 讨论(0)
提交回复
热议问题