Thread: simulate union in subselect

simulate union in subselect

From
"Wei Weng"
Date:
I know this is not do-able, but is there any way to simulate the
following in Postgresql 7.1?

select id from
(select id, recv_date as date from table1 
union
select id, send_date as date from table2) AS subtable
order by date;

Thanks a lot 

Wei


Re: simulate union in subselect

From
Peter Eisentraut
Date:
Wei Weng writes:

> I know this is not do-able, but is there any way to simulate the
> following in Postgresql 7.1?
>
> select id from
> (select id, recv_date as date from table1
> union
> select id, send_date as date from table2) AS subtable
> order by date;

I haven't actually tried whether this does not work, but ISTM that you
could simply do

select id, recv_date as date from table1
union
select id, send_date as date from table2
order by 2;

and ignore the second column when processing the result.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



Re: simulate union in subselect

From
Tom Lane
Date:
"Wei Weng" <wweng@kencast.com> writes:
> I know this is not do-able, but is there any way to simulate the
> following in Postgresql 7.1?

> select id from
> (select id, recv_date as date from table1 
> union
> select id, send_date as date from table2) AS subtable
> order by date;

What gives you the idea that this doesn't work?
        regards, tom lane


order of multiple assignments in UPDATE

From
Anuradha Ratnaweera
Date:
If I have a query
 UPDATE tablename SET c1 = 10 - c2, c2 = 4 where ...

will the two assignments be evaluated from left to right?

Thanks in advance.

Anuradha



Generate GUID in postgresql

From
Wei Weng
Date:
Is there anyway to do so?

Thanks!

-- 
Wei Weng
Network Software Engineer
KenCast Inc.





Re: Generate GUID in postgresql

From
Roberto Mello
Date:
On Wed, Nov 21, 2001 at 06:46:53PM -0500, Wei Weng wrote:
> Is there anyway to do so?

Forgive my ignorance, but what is a GUID?

-Roberto
-- 
+----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+ Roberto Mello - Computer Science, USU -
http://www.brasileiro.net      http://www.sdl.usu.edu - Space Dynamics Lab, Developer    
 
The more things change, the more they stay the same.