MySQL how to 'group by' by math expression
Here is the question. lets assume that i have table like this
id | MF_SONUC
----------
1 | 5
2 | 8
3 | 15
4 | 12
5 | 18
6 | 3
7 | 40
what i want to achieve is to group by dividing the value by some
value(lets take 8). so the result should be something like this
count| step
-----------
3 | 1
2 | 2
1 | 3
1 | 5
so far i got this
SELECT COUNT(CEILING( MF_SONUC /8 )) AS counter , MF_SONUC
FROM `mytable`
ORDER BY CONVERT( REPLACE( MF_SONUC, ',', '' ) , DECIMAL( 10, 2 ) ) ASC
GROUP BY CEILING( MF_SONUC /8 )
here the group clause is raising error. can anyone help me with it? Thanks