Wildcard in the IN clause

后端 未结 2 1110
野趣味
野趣味 2021-01-18 21:16

SQL: I want use the wildcard \"%\" in the IN clause but I\'m not getting the results I expect. My query is like this

SELECT DISTINCT ID,
              FROM I         


        
相关标签:
2条回答
  • 2021-01-18 21:42

    You can't do that. IN is for literals, percent signs are for LIKE. Sorry! So WHERE type LIKE 'IP_%_International'. But if you have several patterns , the only thing you can do is to OR them together.WHERE type LIKE 'IP_%_International' OR type LIKE 'some_%_other_pattern'

    0 讨论(0)
  • 2021-01-18 21:43

    I guess what you're looking for is not an IN Condition, but an LIKE Condition. What about searching for

    SELECT DISTINCT ID, FROM INST WHERE TYPE like 'IP_%_International'
    
    0 讨论(0)
提交回复
热议问题