开发者

How to use LIKE statement in sql plus with multiple wild carded values?

my question is that currently if i want to query for multiple开发者_开发问答 wildcarded values. I need to do something like this.

select customername from customers where customername like '%smith' or customername like '%potter' or customer name like '%harris' or customername like '%williams';

So I wanna ask from the experts, is there any easier way to do this?

Regards, Sanjan


Create a table of your 100 names

select customername from customers c inner join customersames cn on(c.customernamename like '%'+cn.searchForname)

Can be a table variable if that helps.


you can use regular expressions

EDIT: You can find plenty of resources online. take http://66.221.222.85/reference/regexp.html for example.

Regular expressions are really powerful but can be very SLOW if applied carelessly. For your case they may not squeeze your syntax much because you need to type those names anyway and that's the bulky part.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜