Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Question
Message
From
08/07/1999 09:42:28
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00238418
Message ID:
00238833
Views:
13
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
Previous
Reply
Map
View

Click here to load this message in the networking platform