How to sort Username correctly?
For example I do this query:
SELECT * FROM `members` WHERE username LIKE 'bx%' ORDER BY username ASC
Result:
bx1
bx10
bx11
bx12
bx13
bx14
bx15
bx16
bx17
bx18
bx19
bx2
bx20
bx21
bx3
bx4
bx5
I want to return like this:
bx1
bx2
bx3
bx4
bx5
...
bx15
bx16
and so on
The fact that you need to do this tells me your schema is denormalized. If possible, store the integer part of the username in a separate column if you need to do operations on it.
SQL Fiddle Example