How to use LIKE with IN in DB2?

后端 未结 4 1440
名媛妹妹
名媛妹妹 2021-01-11 12:14
SELECT * FROM abc WHERE column1 IN (a1,b1,c1)

I want to use LIKE with this select query; how can I write LIKE statement with IN, similar to the que

4条回答
  •  执念已碎
    2021-01-11 12:19

    If you really want to look for strings starting with a, b or c, you may opt for :

    SELECT * 
    FROM abc
    WHERE LEFT(column1, 1) IN ('a', 'b', 'c')
    

    I assume your case is actually more complex, but maybe you can adapt this snippet to your needs...

提交回复
热议问题