If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > any function/aggrega to do the SUM of string field ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-03-09, 06:00
Michael REMY Michael REMY is offline
Registered User
 
Join Date: Jul 2009
Posts: 14
Question any function/aggrega to do the SUM of string field ?

hi !

i'd like a function to get the sum (concatenate) all the field 's values in a column.

for exemple, with table :
id | lib
---------------------
1 | toto
2 | titi
3 | tata


i'd like this :
SELECT SUM (lib) AS super FROM myTable and get this :
1 row :
super
-----------------
toto titi tata

any idea ?
Reply With Quote
  #2 (permalink)  
Old 07-29-09, 15:55
rski rski is offline
Registered User
 
Join Date: Nov 2006
Posts: 82
Like that (test2 is table name)
Code:
select array_to_string(ARRAY(select lib from test2),' ');
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On