Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sum and count
Message
From
05/11/2013 10:00:36
 
 
To
05/11/2013 07:41:17
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01587291
Message ID:
01587300
Views:
66
>hi all,
>
>i try this code to get result as 9 ,30.43,3,7
>but the result is 9,30,43,10,10
>
>SELECT column27,;
>              CAST(sum(IIF((column5>0)  , column5, 0)) AS N(14,2)) AS File3,;
>              CAST(sum(IIF((column8>0)  , column8, 0)) AS N(14,2)) AS File4,;
>              CAST(count(IIF((column5>0)  , column5, 0)) AS N(4)) AS File5,;
>              CAST(count(IIF((column8>0)  , column8, 0)) AS N(4)) AS File6;
>              FROM wtable2 ;
>GROUP BY column27;
>INTO CURSOR crsTest 
>index on padl(alltr(column27),10,"0")   tag aaa
>BROW NORMAL
>
Rick has given you the answer to your question, but I want to point out that you don't need the IIF() for the SUM() calculations. The result will be the same whether you add the zeroes in or not.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform