|
Hello All,
I am looking for a better way to do the following
task. I have database that has info that looks something like
this
CLIENTID BALANCE
ClientA
210.00
ClientB
202.00
ClientC
300.00
ClientA
200.00
ClientB
250.00
The client wants to see how many clients are in a
certain balance range.
My statement is fairly simple
select clientid,count(*) from table where balance
between 0 and 500 group by clientID
This works fine and returns
ClientA - 2
ClientB - 2
ClientC - 1
Which is fine until they say great now I want to
have the same query for 500 - 1000 and greater than 1000
What I am looking for is a smarter way to do this
instead of making three SQL statements or keep adding a query every time they
want to view move balance ranges.
Is there a way to include the three balance ranges
in a more complex statement?
Thanks
Mike |
