I'm trying to simplify a set of queries into a single one an am struggling with it.
I want to collect counts of different ranges and am doing this right now:
select count(*) from items where value < 0 and id = 43;
select count(*) from items where (value >= 0 AND value <= 10) and id = 43;
select count(*) from items where (value > 10 AND value <= 20) and id = 43;
select count(*) from items where (value > 20 AND value <= 30) and id = 43;
select count(*) from items where value > 30 and id = 43;
I want to be able to do this in a single query. How can I accomplish that?
Also I need each individual queries count still, not just a total of them together.