Saturday, 24 August 2013

Get count of ids from a table grouped by a some range of values

Get count of ids from a table grouped by a some range of values

I have a table like this



id | rating
1 | 1.2
2 | 1.3
3 | 2.3
I want a result like
rating row
1 0 2 2 3 1 4 0 5 0
as row with rating less than 1 is 0 row with rating greater than 1 and
less than 2 is 2 row with rating greater than 2 and less than 3 is 1 row
with rating greater than 3 and less than 4 is 0 row with rating greater
than 4 and less than 5 is 0
I am totally blank how to make this query Help me please

No comments:

Post a Comment