>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
Marcelo, did you try GROUP BY clause there?
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison