Skip site navigation (1) Skip section navigation (2)

Re: Basic SQL join question

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
Cc: PostgreSQL-general <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: Basic SQL join question
Date: 2003-01-31 14:53:22
Message-ID: 20030131065003.U44779-100000@megazone23.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-general
On Fri, 31 Jan 2003, Jean-Christian Imbeault wrote:

> Sorry for this simple question but I can't seem to get Postgres to do
> what I want ...
>
> I want to get the concatenation of 2 or more tables with absolutely
> nothing in common. How can I do this?
>
> For example
>
> Table a:
>
>    a
> -----
>   a1
>   a2
>   a3
>
> Table b:
>
>    b
> -----
>   b1
>   b2
>
> Table c:
>
>    c
> -----
>   c1
>   c2
>   c3
>   c4
>
> What is the proper SQL to return:
>
>    a |  b |  c
> ---------------
>   a1   b1   c1
>   a2   b2   c2
>   a3        c3
>             c4
>

I can't think of a real SQL solution (although there might be
one).  A pl function could do this but it'd be a little wierd
probably.  Note that unless those tables are really selects with
ordering the results are pretty indeterminate and probably
meaningless since order is not guaranteed.



In response to

Responses

pgsql-general by date

Next:From: Peter ChildsDate: 2003-01-31 15:19:29
Subject: History
Previous:From: Berend ToberDate: 2003-01-31 14:39:41
Subject: What is the benefit of schemas?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group