Sum the column values

  • Hi,

    I have this query where I do certain conversions and on top of this how can I sum the column values.

    '$ '+ Replace(CONVERT(varchar,CAST(Total__Amount AS money),1) ,'.00','') as Total_Amount,

    '$ '+ Replace(CONVERT(varchar,CAST(Monthly_Amount As money),1),'.00','') as Monthly_Amount,

    Now on top of this query how can I sum the columns.

  • Could you post some sample data and your expected results please? It will make it a lot easier to answer your questions.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Updated my post and pls take a look.

  • We've still got a lot of guesswork to do to help out, and that's what we're here to do. If you read this article and post some samples like it suggests, it will be a lot easier to see what you want us to do.

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    If you're worried about hiding business practices, change the table and column names to something that hides them but still gives an idea what they do. I work for an organisation with quite a lot to hide (in many ways...) so I went for a pirate theme [/url] when I had a tricky question to post. You don't need to post the full query either. I just posted the edited highlights, it gave an idea of what needed to be done but cut out lines of code and hid everything I wanted to hide.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply