Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Question
Message
From
07/07/1999 15:03:37
 
 
To
07/07/1999 14:49:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00238418
Message ID:
00238458
Views:
11
Well... Not know enough about what you are doing, I would do this:

select "A" as grouptype, cnt(*) as mycnt, field1 from mytable group by mykey having cnt(*) < 30 and cnt(*) > 13.2 ;
union all ;
select "B" as grouptype, cnt(*) as mycnt, field1 from mytable group by mykey having cnt(*) > 1234 and cnt(*) < 9999

Is that more like you are looking for?

>Todd,
>
>No - unfortunately the "real" ranges needed are not so neat - that is - they aren't equally divided. I know that was not evident in my example, but thanks anyway!
>
>Ken
>
>>Could you use interger division to do this?
>>
>>select cnt(*) as mycnt, int(cnt(*)/5)*5 as mygroup from mytable group by mykey
>>
>>>Hi,
>>>
>>>Is there an "easy" way (using 'group by' or similar) to get a count of records in a range from a table?
>>>
>>>Example, suppose you have a simple table with one field for a customer number. Evey time the customer purchases something, they get a new entry in this table. Now it's easy to get a count for each customer of how many purchases they made, however - what if I want a "range count" - that is - a listing of how many customers made 1-5 purchases, how many made 6-10 purchases, 11-15, 16-20 and so on? Is there a way to wrap all this up in a single SQL statement?
>>>
>>>thanks,
>>>Ken
--Todd Sherman
-Wake Up! Smell the Coffee!
Previous
Reply
Map
View

Click here to load this message in the networking platform