|
Question : The SUM function requires 1 argument.
|
|
I've been running this chunk of code for some time now w/out error. I've tried in error to make a change today, it seems I am struggling w/the format. My first error is this:
Server: Msg 257, Level 16, State 3, Line 1 Implicit conversion from data type varchar to money is not allowed. Use the CONVERT function to run this query.
I change each of the calculations to use CONVERT, and now my error is this:
Server: Msg 174, Level 15, State 1, Line 3 The SUM function requires 1 arguments.
Might somebody be able to point me the right direction with this? Also, I need to get my three calculations back into the right format -- using commas and decimals where applicable. For example, 5555 should be 5,555 and the Total $ should have the decimals intact. i.e., 55,555,555.05 unfortunately i'm in a pinch on this w/time, so a very big thank you in advance
SELECT 'Currency Volume - '+LTRIM(LEFT(CONVERT(char(16),CAST(SUM(quantity) AS MONEY),1),13)), 'Total # Trades - '+LTRIM(LEFT(CONVERT(CHAR(16),CAST(count(*) AS MONEY),1),13)), 'Total $ - '+CONVERT(CHAR(16),SUM(Quantity*CAST(Price AS Money),1),13)) FROM db.dbo.table WHERE exectime >= dateadd(day,-0, convert(char(10),getdate(),120)) AND endpoint in (....................)
|
|
Answer : The SUM function requires 1 argument.
|
|
Closed, 250 points refunded.
modulo Community Support Moderator
|
|
|
|