开发者

How to match an area code in MS access

I have 2 area codes I need to match in my database the area code is 214 and 927 I am using the LIKE clause

 select * test where phone like "*972*"

I believe if 972 is anywhere in the开发者_StackOverflow社区 phone number it will be matched. I need 972 to be only matched with the area code.

The phone formats can be (###) ### - #### or ##########

Is this possible to do in access?


Try:

select * from test where left(phone, 3) = "972" -- for ########## format

Or:

select * from test where left(phone, 5) = "(972)" -- for (###) ### - #### format
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜