There is a text field by which the data is sorted. The field can contain the following characters:

-0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 衼袗袘袙袚袛袝袞袟袠袡袣袥袦袧袨袩袪小孝校肖啸笑效楔些歇蝎鞋协挟携 邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌褉褋褌褍褎褏褑褔褕褖褗褘褜褝褞褟褢 

Sorting in the database does not suit me: I would like the sorting order to be as follows:

 袗邪袘斜袙胁袚谐袛写袝械袞卸袟蟹袠懈袡泄袣泻袥谢袦屑袧薪袨芯袩锌袪褉小褋孝褌校褍肖褎啸褏笑褑效褔楔褕些褖歇褗蝎褘鞋褜协褝挟褞携褟 AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz 0123456789 

It is important that E and E be considered as one and the same character, and the hyphen is not taken into account.

How can this be organized in MySQL?

    2 answers 2

     order by replace(myfield,'褢','械') 

    Very not fast, but it will sort. Want faster - dig coding settings or create another column with a string in which e and f have already been replaced by e.

    • Thinking a few options decided to stop at this. Thank. - Denis Khvorostin

    Dig stands in the direction of collation. I don鈥檛 know where to see the order of characters in each of them. And I'm not sure that they will succeed "E and E were considered as one and the same symbol, and the hyphen was not taken into account."

    Update: although not, there is a look at the tables http://collation-charts.org/mysql60/mysql604.utf8_unicode_ci.european.html. And with hyphens, you can deal with something like that

     SELECT REPLACE(columnname, "-", "") as c FROM T ORDER BY c