按MySQL排除连字符的文本字符串排序

时间:2016-05-04 10:31:29

标签: mysql

我有一行MYSQL查询

SELECT * FROM table ORDER BY text_string ASC

字符串,例如

L-IP Readme
LIP-3ECTC Firmware
L-INX Readme
LINX-150 Firmware
LINX-120 Firmware

我得到了什么:

L-INX Readme
L-IP Readme
LINX-120 Firmware
LINX-150 Firmware
LIP-3ECTC Firmware

我希望订单不考虑连字符:

L-INX Readme
LINX-120 Firmware
LINX-150 Firmware
L-IP Readme
LIP-3ECTC Firmware

我是这样做的:

SELECT * FROM table ORDER BY REPLACE (text_string,'-','') ASC

是否有更好的,优化的大型表解决方案?

0 个答案:

没有答案