简体   繁体   中英

How do I sql query for records containing an ampersand in MS Access?

I have a database of customer names and am looking to select only the names that contain an ampersand somewhere in them. I have concatenated the first and last name together and just need to return any records that contain an ampersand.

I've tried using contains and like %&% but neither of those is working because MS access seems to see the ampersand as a variable of some sort?

Here's the code that gives me the lsit of full name, as well as a unique identifier I can use to find the record in the original database.

SELECT [BillTo_FirstName] & " " & [BillTo_LastName] AS FullName, 
June_ampersand.MerchantReferenceNumber
FROM June_ampersand
;

MS Access为LIKE运算符使用不同的通配符-尝试使用LIKE '*&*'条件

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM