[SQL] How to display multiple rows in 1 row - Mailing list pgsql-sql

From Baxter Allen
Subject [SQL] How to display multiple rows in 1 row
Date
Msg-id CAEO6znEtU5ai7K9PqJjeQxjbBpgfn-8=w8QHQmh9L7FHFkamRA@mail.gmail.com
Whole thread Raw
Responses 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>)
List 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 by date:

Previous
From: Rob Sargent
Date:
Subject: Re: [SQL] How to use external java libraries in Database
Next
From: "David G. Johnston"
Date:
Subject: Re: [SQL] How to display multiple rows in 1 row