Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Question
Message
De
27/07/1998 15:57:01
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00121732
Message ID:
00121755
Vues:
13
>>Select Zone,Class,count(*) From Table1 Group by Zone,Class
>
>Ok, that works great. Mind if I add one more level of complication? :)
>
>The one thing this won't list is zones with a count of 0. This makes sense because if that zone isn't in the table, the computer won't even know it exists. There is another table called "Zones" that lists all the zones. Is there a way to tack this on to the SQL so that it does it's count including zones that occur in the zones table but not the other table?
>
>Thanks,
>
>-Michelle
>
>Oh, P.S. I don't want it to _only_ do ones from the zones table because then it won't catch all the ones where the dispatcher typed in the zone wrong, as your SQL does so nicely. :)

Select Zone,Class,count(*) as counter From Table1 ;
Into Cursor tmp nofilter ;
Group by Zone,Class

Select zones.Zone,tmp.Class,tmp.counter From zones,tmp ;
Where zones.zone=tmp.zone ;
Union All Select zone,"" as class, 0 as counter From zones ;
Where zones.zone Not In (Select zone from tmp)
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform