Raja Reddy
Raja Reddy

Reputation: 782

Can we use OR with LIKE predicate in DB2 queries?

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.

Upvotes: 0

Views: 4788

Answers (1)

gbn
gbn

Reputation: 432230

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]%'

Upvotes: 1

Related Questions