问题
I'm trying to have a request with a case sensitive result.
For example in my database I have
ABCdef
abcDEF
abcdef
The request is
SELECT * FROM table WHERE col = 'abcdef'
but I have my 3 rows as result and I just want abcdef
I try to find a solution with
SELECT *
FROM table
WHERE col COLLATE Latin1_General_CS_AS = 'abcdef' COLLATE Latin1_General_CS_AS
but I have this error:
Unknown collation: 'Latin1_General_CS_AS'{"success":false,"error":"#1273 - Unknown collation: 'Latin1_General_CS_AS'"}
Thanks
回答1:
Thanks for your help I find the solution it was not latin1 ut utf8
COLLATE utf8_bin
回答2:
Latin1_General_CS_AS
is a SQL Server collation.
For MySQL, try latin1_general_cs
:
WHERE col = 'abcdef' COLLATE latin1_general_cs
来源:https://stackoverflow.com/questions/16262963/case-sensitive-sql-differentiate-between-upper-and-lower-case