` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please add your comments to this article. Please note that you must provide both a name and a valid email address in order for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

SQL Related Articles: Select with SUM
2002-12-04 -- Ray Goudie
 
Newsgroups: comp.lang.clarion How about using the following: --- SELECT CmpID, sum(case when Amt > 0 then Amt end) AS Debits, sum(case when Amt < 0 then Amt end) AS Credits, sum(case when Amt = 0 then Amt end) AS ZeroAmts FROM GLFINAN GROUP BY CmpID --- -Ray. "Ben Kim (Vertical Dimensions, Inc.)" wrote in message news:3dee3396@news.softvelocity.com... > Hello all, > > I am using MS-SQL 2K and using the following SELECT statement via the Query > designer. However, I am not sure why this statement does not work. > According to the SQL online docs the SUM aggregate function allows for an > expression. Here is the statement: > > SELECT CmpID, SUM(Amt > 0) AS Debits, SUM(Amt < 0) AS Credits, SUM(Amt = > 0) AS ZeroAmts > FROM GLFINAN > GROUP BY CmpID > > It does not like any of the SUM statements. If I just use SUM(Amt) As > EndingBalance it works fine. Obviously I am misinterpreting the books > online or this is just not possible. > > Thanks! > > Ben Kim > >


Today is November 21, 2024, 6:50 am
This article has been viewed 35223 times.
Google search has resulted in 21 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: