> I am using Sybase 7.0.

hi mike

my condolences   ;o)

(just kidding -- i hear sybase is a pretty good database)

> What does Iif mean?

microsoft access "IF" function (simple CASE structure)

> Does your statement count the number of clients or the balances.
> I want to count the number of similar clients in that range.

my query counts the number of balances in each range *per client*

that is consistent with the example that you gave --

   ClientA - 2
   ClientB - 2
   ClientC - 1

it sounds like you want the total number of clients in each range instead

that would be

select 1, "under200", count(*)
   from clientbalances where balance < 200
union all
select 2, "200to500", count(*)
   from clientbalances where balance >= 200 and balance < 500
union all
select 3, "500to1000", count(*)
   from clientbalances where balance >= 500 and balance < 1000
union all
select 4, "over1000", count(*)
   from clientbalances where balance >= 1000
order by 1

note that the order by sorts on the first column, which is a seqence number
to get the ranges in the right order

rudy



-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: "rudy" <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)

Reply via email to