Can we use OR with LIKE predicate in DB2 queries?

放肆的年华 提交于 2020-01-06 08:23:24

问题


I have a query to select names of employee start with 'y', then my query would be

SELECT EMP_NM FROM EMP
WHERE EMP_NM LIKE'Y%'

Say for example

I need to retrieve names of employee names start with both 'y' and 'z', do we have anything to suffice my requirement? It's something like using OR with LIKE, correct?

Your time and responses are highly appreciated.


回答1:


WHERE EMP_NM LIKE 'Y%' OR EMP_NM LIKE 'Z%'

or, not sure if DB2 supports this (not even sure I have right link to documentation...)

WHERE EMP_NM LIKE '[YZ]%'


来源:https://stackoverflow.com/questions/5370662/can-we-use-or-with-like-predicate-in-db2-queries

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!