[SQL] How to display multiple rows in 1 row

Поиск
Список
Период
Сортировка
От Baxter Allen
Тема [SQL] How to display multiple rows in 1 row
Дата
Msg-id CAEO6znEtU5ai7K9PqJjeQxjbBpgfn-8=w8QHQmh9L7FHFkamRA@mail.gmail.com
обсуждение исходный текст
Ответы Re: [SQL] How to display multiple rows in 1 row  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: [SQL] How to display multiple rows in 1 row  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-sql
Hello,

I have a database with a large number of individuals, and for each of these individuals there are entries in multiple tables as follows:

table_a
_idindividual
1.table_b1
2.table_b2
3.table_b3
1.table_c1
2.table_c2
3.table_c3

table_b
_idvalAvalB
1.table_b12
2.table_b47
3.table_b54

table_c
_idvalCvalD
1.table_c43
2.table_c34
3.table_c221

Using the following code:
Select distinct C.individual, A.*, B.*
FROM table_a A
 LEFT JOIN table_b B ON A._id = B._id
 LEFT JOIN table_c C ON A._id = C._id
order by A.individual

I get the following output:
individual_idvalAvalB_idvalCvalD
11.table_b12
11.table_c43
22.table_b47
22.table_c34
33.table_b54
33.table_c221

Instead, I would like the output for each individual to be all on a single row:
individual_idvalAvalB_idvalCvalD
11.table_b121.table_c43
22.table_b472.table_c34
33.table_b543.table_c221

Any idea how I could make that happen?

Thanks!

Baxter

В списке pgsql-sql по дате отправления:

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: [SQL] How to use external java libraries in Database
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: [SQL] How to display multiple rows in 1 row