MsSQL

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesMsSQL

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old August 7th, 2015, 08:24 AM
WHP WHP is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Aug 2015
Posts: 2 WHP User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 29 sec
Reputation Power: 0
SQL 2012 SUM and Cast

I have field value that is Varchar and would like to simultaneously SUM the field and cast it as $'s.

I have tried this, but not getting me what I need, the SUM does not seem to work?

SELECT SUM(Field1) as SUMPDAMT, '$'+ CONVERT(varchar(100),
CAST(Field1 as money),1) as converted_amount
FROM dbo.XXX
WHERE Field2 = 'xxxxxxx'
GROUP BY Field1

/*(No column name) converted_amount
6.47 $6.47
3787.95 $757.59
Not Correct*/

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesMsSQL > SQL 2012 SUM and Cast


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap