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

Re: Querying from two tables as if they were appended

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Querying from two tables as if they were appended
Date: 2006-05-18 05:56:47
Message-ID: 20060518055646.GB14405@webserv.wug-glas.de (view raw or flat)
Thread:
Lists: pgsql-novice
am  17.05.2006, um 11:43:59 -0400 mailte David Gaudine folgendes:
> I have two tables with an identical layout.  The difference is that one has 
> data from this year and one has data from last year.  For a simplified 
> example let's call them "table05" and "table06", and say that each has a 
> single column called "name".  So we have
> 
> table05:
>      David
>      Bob
> 
> table06:
>      David
>      John
>      Paul
> 
> I want to select all rows from both tables, so the result (order not 
> important) is
>      David
>      Bob
>      David
>      John
>      Paul

select col from table05 union all select col from table06;




HTH, Andreas.
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    === 

In response to

pgsql-novice by date

Next:From: Verena RuffDate: 2006-05-18 10:51:10
Subject: select count(*) and limit
Previous:From: Dhruv MataniDate: 2006-05-17 17:35:27
Subject: Where to get more info. about the optimizer?

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