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

how do I select unions into a temp table

From: TJ <tj(at)getlostspammers(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: how do I select unions into a temp table
Date: 2004-08-21 01:01:05
Message-ID: l9xVc.8398$Bt5.4805@twister.socal.rr.com (view raw or flat)
Thread:
Lists: pgsql-general
I want to do something like this, but I can't seem to find the right syntax:

select * into temp tblDest where(
 (select t0.* 
 from tblSource0 t0, tblExtension1 t1 
 where t0.colA = 1 and t0.oid_parent = t1.oid
 )
 union
 (select t2.* 
 from tblSource2 t2, tblExtension3 t3
 where t2.colA = 1 and t2.oid_parent = t3.oid
 )
)

You'll notice that I'm trying to do this all in a single query... I'm
essentially merging and eliminating duplicates simultaneously.

-- 
TJ

Responses

pgsql-general by date

Next:From: JeffDate: 2004-08-21 01:46:23
Subject: Re: Postgres filling up hard drive with swap files
Previous:From: Marc G. FournierDate: 2004-08-21 00:19:38
Subject: New Stable Releases to Address Critical Bugs

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