MYSQL order by regexp
So, today I found that you can use regular expressions in the order by clause in MySQL. I'm using this for a field that can be either number, alpha, or a mix.
This is what is looks like. I'm saying that if the number starts with 0 - 9 then add 0 and it sorts like a number, otherwise, just sort on the alpha.
'if(number REGEXP \'^[0-9]\',number + 0, number)'
0 comments
Twitter