سؤال

In MySQL, I can specify the collation if I have a standard WHERE clause like this:

SELECT * FROM myTable WHERE email_address = 'foo@bar.com' COLLATE utf8_general_ci;

However the following fails if I have multiple email addresses in a WHERE-IN clause

SELECT * FROM myTable WHERE email_address IN ('foo@bar.com', 'test@test.com') COLLATE utf8_general_ci;

What am I missing to get this to work? Mysql 5.5.

Thanks!

هل كانت مفيدة؟

المحلول

What if you specify it after every string:

WHERE email_address IN ('foo@bar.com' COLLATE utf8_general_ci, 'test@test.com' COLLATE utf8_general_ci)

?

نصائح أخرى

try this

SELECT * 
FROM myTable 
WHERE FIND_IN_SET( email_address, 'foo@bar.com,test@test.com' COLLATE utf8_general_ci );
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top