-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: String to int conversion with aggregate
PostPosted: Tue Jan 15, 2008 3:45 pm 
Newbie

Joined: Fri Mar 17, 2006 3:40 pm
Posts: 1
All,
I have a column of type String and the values in it are purely numbers. I would like to get a SUM on that String column.

How do i do this?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2008 4:12 pm 
Beginner
Beginner

Joined: Mon Mar 17, 2008 2:50 pm
Posts: 24
If you haven't yet found an answer you can do it in plain (native) sql query:
Code:
select sum(convert(your_column, DECIMAL)) from whatever_table where <your where clause>

I am using MySQL functions but any RDBMS have their own sybtax in this regard. Just RTFM.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2008 5:33 pm 
Beginner
Beginner

Joined: Tue Oct 30, 2007 7:57 am
Posts: 47
Yes, just use the same functions as if you where querying your database. Unfortunately, there is not an standard for this.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.