Re: [GENERAL] select union with table name

2007-01-02 Thread Alban Hertroys
Reece Hart wrote: > On Thu, 2006-12-28 at 19:09 +0700, Akbar wrote: > Note the 'all' after union... I suspect you'll want that or should at > least consider it. Not using it will give the exact same results in a slower way; 'blue' and 'red' are different, after all. You'll be hard pressed to find

Re: [GENERAL] select union with table name

2006-12-28 Thread Reece Hart
On Thu, 2006-12-28 at 19:09 +0700, Akbar wrote: > select blue.name from blue union select red.name from red > give me this: > name > 'blabla' > 'bubu' > 'haha' > 'kkk' > > I want this: > nametable_name > 'blabla' blue > 'bubu'blue > 'haha'red > 'kkk' red > > Could I? select

FW: [GENERAL] select union with table name

2006-12-28 Thread antsumees
rg Subject: [GENERAL] select union with table name Hi, I have two tables. create table blue ( id serial primary key, name text not null, kill text not null ); create table red ( id serial primary key, name text not null, kiss text not null ); select blue.name from blue union select red

Re: [GENERAL] select union with table name

2006-12-28 Thread Richard Broersma Jr
> I want this: > nametable_name > 'blabla' blue > 'bubu'blue > 'haha'red > 'kkk' red > > Could I? Here is an example from the table inheritance chapter: SELECT p.relname, c.name, c.altitude FROM cities c, pg_class p WHERE c.altitude > 500 and c.tableoid = p.oid; which returns

Re: [GENERAL] select union with table name

2006-12-28 Thread Joris Dobbelsteen
>From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of Akbar >Sent: donderdag 28 december 2006 13:10 >To: pgsql-general@postgresql.org >Subject: [GENERAL] select union with table name > >Hi, I have two tables. >create table blue ( > id serial primary

[GENERAL] select union with table name

2006-12-28 Thread Akbar
Hi, I have two tables. create table blue ( id serial primary key, name text not null, kill text not null ); create table red ( id serial primary key, name text not null, kiss text not null ); select blue.name from blue union select red.name from red; give me this: name 'blabla' 'bubu' 'hah

Re: [GENERAL] Select Union

2004-04-01 Thread Tom Lane
Randall Skelton <[EMAIL PROTECTED]> writes: > As you suggested, while this is much shorter in length, it is > considerably longer in execution. >> SELECT t1.timestamp FROM ( >> SELECT timestamp FROM cal_quat_1 UNION >> SELECT timestamp FROM cal_quat_2 UNION >> SELECT timestamp FROM cal_quat_3 UNI