Re: Concatenating multiple fetches into a single string
От | Tomasz Myrta |
---|---|
Тема | Re: Concatenating multiple fetches into a single string |
Дата | |
Msg-id | 3FCC2C2E.2050106@klaster.net обсуждение исходный текст |
Ответ на | Re: Concatenating multiple fetches into a single string ("Kumar" <sgnerd@yahoo.com.sg>) |
Список | pgsql-sql |
Dnia 2003-12-02 05:51, Użytkownik Kumar napisał: > Thanks for your reply. > > But how to use this comma_aggregate( ) function to concatenate the fetched > columns values from a select statement. In my example my select stmt fetches > the following 3 rows. How can I use this function to concatenate them. > > Select full_name FROM project_members where project_members.project_role_id > in ( ' x,y,z ') ; > > full_name > --------------- > David > Postgres > plpgsql > > Expected return string is - 'David,Postgres,Plsql' Where is the problem? It's an aggregate function - you use it like the other ones: select comma(full_name) from... There is one problem with this function - strings order is unexpectable, but you can always sort them in subselect before using this function: select comma(full_name) from (select full_name from .... order by full_name) X; Regards, Tomasz Myrta
В списке pgsql-sql по дате отправления: