Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF in Select
Message
From
24/11/1998 15:51:11
 
 
To
24/11/1998 15:46:19
Carl Sarazin
Statistics Canada
Ottawa, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00161059
Message ID:
00161103
Views:
24
>Thanks Mike for your reply.
>
>That would give me the number of occurences by grouping. Unfortunately it's a little more than that. What we're trying to do is (within one statement) get conditional counts for ranges. For instance, one count if the field is from 0 - 9, another if 10 - 19, etc. without having to generate a grouping indicator in advance. Ultimately we are trying to create a report with columns meeting certain criteria.

You can use UDF:
Select getcolumn(field1) As cField1, Count(*) as Counter ;
From MyTable ;
Group by 1

Function getcolumn
LParameter nField1
Do Case
Case nField1<10
Return "A"
Case nField1>=10 and nField1<20
Return "B"
....
EndCase
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform