Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Counting groups
Message
 
To
08/01/2007 12:32:24
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Miscellaneous
Thread ID:
01183483
Message ID:
01183505
Views:
14
>>>My brain seems to be asleep today. Is there a simple way to count the number of groups in a report? If the report cursor is created with
>>>
>>>
>>>select companies.company_name, companies.company_id, sites.site_name ;
>>>	from (lcCompanyfile) companies ;
>>>	full join (lcSitefile) sites ;
>>>	on companies.company_id = sites.company_id ;
>>>	where sites.status = "TRP" ;
>>>	order by companies.company_name, sites.site_name ;
>>>	into cursor crsTemp
>>>
>>>and the report is grouped on company_name, how would you count the number of unique company names? All my attempts result in counting every record. I could create a unique index before calling the report but that seems clumsey to me.
>>>
>>>Thanks
>>
>>Version of VFP?
>
>Version 9

If you want that count to be in the cursor:
select companies.company_name,;
       companies.company_id,;
       sites.site_name,;
       Tbl1.NameGroupCount;
from (lcCompanyfile) companies ;
full join (lcSitefile) sites on companies.company_id = sites.company_id ;
LEFT JOIN (SELECT company_name, COUNT(*) AS NameGroupCount;
                  FROM (lcCompanyfile) GROUP BY company_name) Tbl1;
ON companies.company_name = Tbl1.company_name
where sites.status = "TRP" ;
order by companies.company_name, sites.site_name ;
into cursor crsTemp
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform