Alfanumeric订购

时间:2015-10-01 12:08:57

标签: mysql

我想对以下数据项进行排序,但有时他会将B放入A.(U8B-U8A,U11B-U11A,U15B-U15A和U17B-U17A) 使用的查询是:

SELECT * FROM trainers
ORDER BY CAST(SUBSTR(cat,2) AS SIGNED) AS

如何解决这个问题?

Cat  fisrt    last
U5   Steve    Vangeel
U6   Steve    Vangeel
U7A  Davy     Cums
U7B  Gerbe    Suttels
U8B  Roel     Tastenoye
U8A  Davy     Vlasselaerts
U9A  Jordi    Knops
U9B  Piet     Veulemans
U9C  Tom      Delie
U9C  Patrick  Uyttebroeck
U10A Jonas    Delvaux
U10B Ruben    Francois
U11B Peter    Desmet
U11A Tom      Delie
U12B Hans     Smets
U12A Joeri    Tits
U13  Patrick  Vanuytrecht
U15B Ronny    Vanderhoeft
U15A Gunther  Roosen
U17B Dirk     Knops
U17A Jonas    Vanhelmont
U17A Tim      Knops
U21A Patrick  Uyttebroeck
U21B Luc      Mathues

0 个答案:

没有答案