Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating LIKE statements with Boolean Statements

Status
Not open for further replies.

proteome

Technical User
May 14, 2003
115
US
I was wondering if it were possible to create an SQL statement with multiple LIKE statements. I have been trying the following and it does not work

"WHERE Something LIKE '*KR?S' OR '*KK?S'"

what is wrong with this (it pulls everything)? Could someone please explain this and if so show me if it can be done.

Thanks
 
Need to state the condition fully each time, the column name & operator isn't assumed in a compound where clause.

WHERE Something LIKE '%KR_S' OR Something LIKE '%KK_S'

Note the SQL wildcards are % and _ not * and ?

Paul Bent
Northwind IT Systems
 
paulbent's syntax is correct but the wild-cards that you use depend on the data access method. DAO uses "*" and "?" while ADO uses "%" and "_" (i.e. ADO is SQL-92 compliant; DAO and native Access are not.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top