Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using count() in SQL Select
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00872467
Message ID:
00872485
Vues:
24
This message has been marked as the solution to the initial question of the thread.
Try
SELECT EMPLOYEE, type, count( distinct type + STR(ORDER_NO,10) ) as NUM_ORDS 
FROM mytable 
group by EMPLOYEE, type ;
INTO CURSOR crsTemp
SELECT EMPLOYEE, SUM(IIF(type="A", NUM_ORDS,0) AS cnt_a, ...
FROM crsTemp;
group by EMPLOYEE
>Sergey,
>
>Your approach will count total number of A orders and B orders. But I want to count number of UNIQUE orders. In example below George had 2 unique B orders yet he had 3 total B orders.
>
>Thank you.
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform