Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using count() in SQL Select
Message
 
 
To
30/01/2004 14:26:21
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00872467
Message ID:
00872485
Views:
23
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform