Subject | RE: [firebird-support] How to join multiple rows into a single string in FB? |
---|---|
Author | Sasha Matijasic |
Post date | 2008-02-24T20:59:44Z |
>At the moment, you can achieve the desired result with selectable stored procedure but there is no way you do that in sql.
> How do I write an SQL for this? So the result of the query should be
> like:
> NameID1, Name1, 'MemberName1, MemberName2, MemberName3, etc.'
> NameID2, Name2, 'MemberName4, MemberName5, etc.'
> ...
>
FB 2.1 will introduce list aggregate function that will do exatcly what you want, something like this:
select nameid, min(name), list(membername)
from names
left join members on members.nameid = names.nameid
group by nameid
Sasha