Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Small .prg slows network
Message
From
16/11/1997 17:31:01
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00060184
Message ID:
00060573
Views:
33
>>>> >>>>Larry- I think what you are trying to do can be accomplished with one >statement: >>>> >>>>SELECT count(*), distinct *; >>>>FROM masterfile; >>>>INTO CURSOR countfile; >>>>WHERE inactive <> "Y"; >>>>GROUP BY agegrp, district >>>> >>>>This doesn't directly apply to your question, but could possibly reduce >the time it takes to create your countfile table. >>>>HTH >>> >Yes, I left out a few words... > >What if I want to group agegrp's into categories (Under_50 and Over_50) and >get totals by category (assume that agegrp contains the actual age in >years)???? Then you should just run another select on the resulting cursor from the first select, like this SELECT count(*) as cnt, *; FROM masterfile; INTO CURSOR countfile; WHERE inactive <> "Y"; GROUP BY agegrp, district; into cursor first select agegrp>50 as over_50, sum(cnt) as cnt, district; from first; group by district, over_50; into curs second This way you'll have .t. or .f. in the over_50 column, and sum of appropriate counts, without the need to run the whole select on the big table again. Another approach could be select district, sum(iif(agegrp>50,cnt, 0) as over_50, sum(iif(agegrp<=50,cnt, 0) as under_50, ; from first; group by district; into curs second ....which would give you one record per district, in a form more suitable for reporting.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform