我想按字母顺序对公司名称进行排序,无论名称中是否包含“公司”.
SELECT *
FROM company_detail
ORDER BY comp_name
在数据库中,comp_name类似于
Company A
E
B Company
F Company
Company H
D
C Company
Company G
当订购结果为时,可以创建ORDER BY:
Company A
B Company
C Company
D
E
F Company
Company G
Company H
感谢帮助.
解决方法:
这样的事吧?
SELECT comp_name, REPLACE(comp_name, 'Company', '') as c
FROM company_detail
ORDER BY c