To all who replied,
Thanks for your replies. I already had a "two step" way of handling it, but it's nice to see that the "more than one way to skin a cat" adage holds up here too. I was really hoping for a one step process, but oh well ... as has been demonstrated, there are several good ways to do it in just two steps and that works good for me.
thanks all!
Ken
>Ken, you can use two simple sql commands to get this done as follows:
>
>select custno, cnt(*) as prchasecnt ;
>from purchases ;
>group by custno into cursor PurCntCurs
>
>select ;
> sum(iif(between(prchasecnt,1,5), 1, 0)) as pur_1_5,;
> sum(iif(between(prchasecnt,6,10), 1, 0)) as pur_6_10,;
> sum(iif(between(prchasecnt,11,15), 1, 0)) as pur_11_15,;
> sum(iif(between(prchasecnt,16,20), 1, 0)) as pur_16_20,;
> sum(iif(prchasecnt>21, 1, 0)) as pur_20_over ;
> from PurCntCurs
Ken B. Matson
GCom2 Solutions