The SUM function requires 1 arguments.

This works fine, but the resulting value is w/out commas to the left of the decimal:  315683437.1000

SELECT SUM(LastFillQuantity*CAST(LastFillPrice AS Money)) AS 'Total $ - '
FROM trading.dbo.trade
where timeofexecution  >= left(getdate()-0, 11)
and destination = 'aaaa'

I usually do a conversion w/MONEY in order to get the commas in place -- like this query gives me this:
Stocks Volume -   232,096,074
Total # Trades - 743,924      

SELECT 'Stocks Volume -   '+LTRIM(LEFT(CONVERT(char(16),CAST(SUM(LastFillQuantity) AS MONEY),1),13)),
+'Total # Trades - '+LTRIM(LEFT(CONVERT(char(16),CAST(count(*) AS MONEY),1),13))

but when i try that here, i get this:  
Server: Msg 174, Level 15, State 1, Line 1
The SUM function requires 1 arguments.

SELECT CONVERT(varchar(15),CAST(SUM(LastFillQuantity*CAST(LastFillPrice AS Money),1) AS 'Total $ - '
FROM trading.dbo.trade
where timeofexecution  >= left(getdate()-0, 11)
and destination = 'aaaa'

any help?
LVL 1
RLLewisAsked:
Who is Participating?
 
mokuleCommented:
I've got it

SELECT CONVERT(varchar(15),SUM(LastFillQuantity*CAST(LastFillPrice AS Money)),1) AS 'Total $ - '
FROM trading.dbo.trade
where timeofexecution  >= left(getdate()-0, 11)
and destination = 'aaaa'
0
 
mokuleCommented:
Maybe this

SELECT CONVERT(varchar(15),SUM(LastFillQuantity*CAST(LastFillPrice AS Money))) AS 'Total $ - '
FROM trading.dbo.trade
where timeofexecution  >= left(getdate()-0, 11)
and destination = 'aaaa'

0
 
RLLewisAuthor Commented:
no, that gives me this value:  315683437.10

i've always gotten my commas in place w/my money conversion.  it's just not happening this time, though
0
 
RLLewisAuthor Commented:
Beauty!  I've been bothering over these two items for much of the afternoon.  Sometimes it's these little ones that will get ya.  I can't thank you enough.
0
 
mokuleCommented:
Glad to help You
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.