Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sum and Count filtered records in an SQL statement
Message
From
26/11/1998 14:17:40
Marcelo Codino
Mystic & Faith - Sistemas -
Buenos Aires, Argentina
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Sum and Count filtered records in an SQL statement
Miscellaneous
Thread ID:
00161836
Message ID:
00161836
Views:
48
I have this SQL statement.The instruction works correctly but it sums and counts all table records.I want to do this but only with filetered records.Is it possible in the same instruction ?

Thanks in advance.

SELECT a.field1, a.field2, a.field3, a.field4 ;
FROM mytable a ;
SUM(a.field3) AS n_imp, ;
COUNT(a.field1) AS n_can ;
WHERE a.field2 = tcperiod ;
AND a.field3 = tcyear ;
ORDER BY a.field1 ;
INTO CURSOR myCursor
Thanks in advance
Next
Reply
Map
View

Click here to load this message in the networking platform