From: Steve Midgley <science@misuse.org>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Baxter Allen <baxter.allen@gmail.com>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: How to display multiple rows in 1 row
Date: Tue, 10 Jan 2017 20:01:52 -0800
Message-ID: <CAJexoSKdVebRKKNXN3TCsyLh9G+o7PyifCUw75o_P0ZrNxyEJA@mail.gmail.com> (raw)
In-Reply-To: <CAKFQuwYLEsEJd-NyGbEa=XFMW3PWLKXayjkOo=Zj_btXAjkkEA@mail.gmail.com>
References: <CAEO6znEtU5ai7K9PqJjeQxjbBpgfn-8=w8QHQmh9L7FHFkamRA@mail.gmail.com>
<CAKFQuwZZnTXhqpLc8LtJ90t=sCOyK0FxPRJg9wWkvR_dy1HX4w@mail.gmail.com>
<CAJexoSL3vBFfSdyEoqBP2-JWwV+i5vH9F+Ek+=m-eOo_kom3Ug@mail.gmail.com>
<CAKFQuwYLEsEJd-NyGbEa=XFMW3PWLKXayjkOo=Zj_btXAjkkEA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
On Tue, Jan 10, 2017 at 7:40 PM, David G. Johnston <
david.g.johnston@gmail.com> wrote:
> On Tuesday, January 10, 2017, Steve Midgley <science@misuse.org> wrote:
>
>>
>> Given the DDL at the bottom of my email (what I used to test), this sql
>> statement works, I think:
>>
>> select * from
>> (select a.id as a_id, * from table_a a
>> left join table_b b on a.id=b.id) a1
>> join table_c c on a1.a_id = c.id
>>
>>
>> Returns
>>
>> "1.table_c";"1.table_c";1;"";;;"1.table_c";4;3
>> "2.table_c";"2.table_c";2;"";;;"2.table_c";3;4
>> "3.table_c";"3.table_c";3;"";;;"3.table_c";2;21
>>
>>
> Aside from executing without error I don't see how this works at all.
> You cannot solve the posed problem by rearranging simple joins.
>
> David J.
>
Ugh - my bad - I only checked the table_c data in my results and got what I
was expecting. I'm out of time tonight to play with this - apologies for
bogus response. I'll see if I can rectify tomorrow.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: science@misuse.org, david.g.johnston@gmail.com, baxter.allen@gmail.com
Subject: Re: How to display multiple rows in 1 row
In-Reply-To: <CAJexoSKdVebRKKNXN3TCsyLh9G+o7PyifCUw75o_P0ZrNxyEJA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox