-
2 SUM()s in a Select Fails ADO
I'm fairly new to ASP pages so please bear with me. I'm using PErsonal Web Server and Access 97.
I have a select statement which works fine with one SUM() statement
SELECT Sum(Hdlg) as SubHdlg FROM Orders
Set RSSumOrd = Connection.Execute(SQLStmt)
But, If I add a 2nd SUM() it fails on the 2nd AS statement
SELECT Sum(Hdlg) as SubHdlg, Sum(Total) as Subtotal FROM Orders
Set RSSumOrd = Connection.Execute(SQLStmt)
Anyone got a clue? Yes - Total is a field in ORders
Thanks!
-
2 SUM()s in a Select Fails ADO (reply)
I answered my own question. Apparently the statement is working but when I was adding the results together - I get a blank value.
So I found out that adding a good value to a null variant type produces a null or blank.
Is there a way to add 2 values together even if one is a null?
for example:
Dim val1, val2
val1 = 1
val2 = null
val1 + val2 = null ? why
Can I force val2 to be 0 if null?
Thanks
On 1/23/99 4:01:50 PM, Scott Smiley wrote:
>
I'm fairly new to ASP pages so please bear with me. I'm using
> PErsonal Web Server and Access 97.
I have a select statement which works
> fine with one SUM() statement
SELECT Sum(Hdlg) as SubHdlg FROM
> Orders
Set RSSumOrd = Connection.Execute(SQLStmt)
But, If I add a 2nd
> SUM() it fails on the 2nd AS statement
SELECT Sum(Hdlg) as SubHdlg,
> Sum(Total) as Subtotal FROM Orders
Set RSSumOrd =
> Connection.Execute(SQLStmt)
Anyone got a clue? Yes - Total is a field in ORders
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|