-->
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.  [ 1 post ] 
Author Message
 Post subject: How do I concat string of different rows (under same col)?
PostPosted: Wed Aug 19, 2009 11:31 pm 
Newbie

Joined: Fri Jun 12, 2009 5:51 am
Posts: 3
Hi,

I have a data set like this:

col1 , col2
------------
'A' , 'aa'
'A' , 'bb'
'A' , 'cc'
'B' , 'dd'
'B' , 'ee'

By using grouping, currently we have aggregate functions like: sum(...), avg(...), etc...
But sum(...) is to sum all number values. Do we have any function or any way to 'sum' the String values?

For example, based on the data set above, i want to retrieve the concat string like this (after grouping col1):
'A': 'aabbcc'
'B': 'ddee'

I heard that there is a function called 'group_concat' in mysql, do we have similar function in HQL?


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

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.