我有一个mysql-phpbb数据库,它的一个表,有一个标题列,内容类似于"[data]moredata(info)"
我想按字母顺序排列那张表,但只使用标题中的"moredata"字符串,避免了de[data]和(info)
例如:
[article] Advise for dummies (pdf)
[Review] Star wars (selfWrote)
[film] The Avengers (trailer)
并获得如下排序的mysql表:
[article] Advise for dummies (pdf)
[film] The Avengers (trailer)
[Review] Star wars (selfWrote)
每一行都使用"为假人提供建议"、"复仇者联盟"、"星球大战"作为elment来获得字母顺序。
有人能帮我吗?如果不可能,我可以用PHP做吗?
试试这个:
SELECT * FROM table ORDER BY SUBSTR(title, POSITION("]" IN title) + 1, ((POSITION("(" IN title)) - POSITION("]" IN title) - 1)) ASC