在MySQL中,如果我有一个像这样的标准WHERE子句,我可以指定排序规则:
SELECT * FROM myTable WHERE email_address = 'foo@bar.com' COLLATE utf8_general_ci;
但是,如果我在WHERE-IN子句中有多个电子邮件地址,则以下操作失败
SELECT * FROM myTable WHERE email_address IN ('foo@bar.com', 'test@test.com') COLLATE utf8_general_ci;
我错过了什么让这个工作? Mysql 5.5。
谢谢!
答案 0 :(得分:3)
如果在每个字符串后指定它,该怎么办:
WHERE email_address IN ('foo@bar.com' COLLATE utf8_general_ci, 'test@test.com' COLLATE utf8_general_ci)
答案 1 :(得分:1)
试试这个
SELECT *
FROM myTable
WHERE FIND_IN_SET( email_address, 'foo@bar.com,test@test.com' COLLATE utf8_general_ci );