我有一个简单的mysql查询,从表中提取AES_ENCRYPTED
个名字,
我希望结果显示在alphabetical order
,但问题是结果首先显示资本结果 ..
我的意思是
A
B
a
b
但我想要
A
a
B
b
这是我的query
..
select
id as id,
AES_DECRYPT(fname,'$_ENCKEY') as fname1,
AES_DECRYPT(lname,'$_ENCKEY') as lname
from patient
order by fname1 ASC
我也试过LOWER, UPPER, UCASE etc....
但没有运气......
我正在使用 PDO ...
答案 0 :(得分:1)
尝试将AES_ENCRYPT的返回值强制转换为CHAR。
select
id as id,
CAST(AES_DECRYPT(fname,'$_ENCKEY') AS CHAR CHARACTER SET latin1 ) as fname1,
AES_DECRYPT(lname,'$_ENCKEY') as lname
from patient
order by fname1 collate latin1_general_cs
答案 1 :(得分:0)
这是一个区分大小写的问题:
尝试:
select
id as id,
AES_DECRYPT(fname,'$_ENCKEY') as fname1,
AES_DECRYPT(lname,'$_ENCKEY') as lname
from patient
order by fname1 COLLATE 'latin1_swedish_ci' ASC