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
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
> 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
Try:
select blue.name, 'blue' from blue union select red.name, 'red' from
red;
Not tested, but that should work.
One thing to remember:
If blabla is in both blue and red, it will appear twice, instead of only
once as in your example.
- Joris
>-Original Message-
>From: [EMAIL PROTECTED]
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