开发者

Wildcard in the IN clause

开发者 https://www.devze.com 2023-02-11 09:06 出处:网络
SQL: I want use the wildcard \"%\" in the IN clause but I\'m not getting the results I expect. My query is like this

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 INST
WHERE TYPE in ('IP_%_International')

Please help resolve this and the solu开发者_开发技巧tion should be with the IN clause.


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'


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

精彩评论

暂无评论...
验证码 换一张
取 消