php-通过忽略特定单词(例如单词“ company”)对名称进行排序的方法,无论该单词是否包含?
作者:互联网
我想按字母顺序对公司名称进行排序,无论名称中是否包含“公司”.
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
标签:substring,sql-order-by,trim,php 来源: https://codeday.me/bug/20191109/2011143.html