my mysql query dont humanize the ORDER BY.
SELECT COUNT(level) as count, level
from logtest
GROUP BY level
ORDER BY level;
Sample:
6
5
5
5
13
0
The correct would be
13
6
5
5
5
0
any help?
my mysql query dont humanize the ORDER BY.
SELECT COUNT(level) as count, level
from logtest
GROUP BY level
ORDER BY level;
Sample:
6
5
5
5
13
0
The correct would be
13
6
5
5
5
0
any help?
SELECT COUNT(level) as count, level
FROM logtest
GROUP BY level
ORDER BY cast(level as unsigned);
Near Dup of: Cast from VARCHAR to INT - MySQL
Not quite a dup because the issues on sort is that it's sorting by a text field (my guess is level is of character type) when you want it to sort by numeric type... so just cast which the above link describes how.