Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 LIKE operator in Access

Author  Topic 

Mazdak
Yak Posting Veteran

63 Posts

Posted - 2003-12-26 : 03:00:20
In SQLServer when I want column that start between range of a to b I use this syntax:

column LIKE '[a-b]%'

But it seems that it does not worl correctly in Access. How should I get that query in Access?

mrameshchandra
Starting Member

4 Posts

Posted - 2003-12-26 : 03:50:06
Try this!
<field name> between 'a%' and 'b%'

ramesh chandra
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-12-26 : 05:00:46
The modulo (%) operator in SQL Server is replaced by the asterisk (*) in Access. You could try LIKE '[a-b]*', though I am not quite sure if the range bit works. In that case you'll have to break it apart into multiple conditions, i.e. column LIKE 'a*' OR column LIKE 'b*'...

OS
Go to Top of Page

Mazdak
Yak Posting Veteran

63 Posts

Posted - 2003-12-26 : 05:11:51
Thanks for your replies. It works now in a regular SELECT statement but I want it to use in INNER JOIN too but it doesn't work.My string is something like this :

SELECT ContactsInfo.ContactId,ContactsInfo.FirstName,PhonesInfo.Phone,PhonesInfo.Category FROM ContactsInfo INNER JOIN PhonesInfo ON ContactsInfo.ContactID = PhonesInfo.ContactID WHERE (ContactsInfo.FirstName BETWEEN 'a%' AND b%')

But no record returns and if I chanfe WHERE to AND I gor error that "Join Expression not supported" Any idea?


For * character, I got incorect result too. :(
Go to Top of Page

Mazdak
Yak Posting Veteran

63 Posts

Posted - 2003-12-26 : 05:30:17
Forget it I found it,it was problem with my desighn ,LIKE oerrator works with % now.
Go to Top of Page
   

- Advertisement -