How to use SQL LIKE condition with multiple values in PostgreSQL?

前端 未结 6 1355
小蘑菇
小蘑菇 2020-12-04 18:03

Is there any shorter way to look for multiple matches:

 SELECT * 
 from table 
 WHERE column LIKE \"AAA%\" 
    OR column LIKE \"BBB%\" 
    OR column LIKE \         


        
6条回答
  •  再見小時候
    2020-12-04 18:19

    Following query helped me. Instead of using LIKE, you can use ~*.

    select id, name from hosts where name ~* 'julia|lena|jack';
    

提交回复
热议问题