469,090 Members | 1,246 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,090 developers. It's quick & easy.

CREATE TABLE AS COMMAND

To whom it may concern,

The following select works fine until I use the CREATE TEMP TABLE AS command because of the matching participant_id's in each table.

SELECT * FROM addresses LEFT OUTER JOIN contacts ON
contacts.participant_id = addresses.participant_id;

Running the select obviously works fine, it's just when I try to create a table when I runn into problems. Do I have to list all of the fields exceptthe one I don't want, or is there another way? Thanks in advance.

Bob Powell

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #1
2 1425
On Fri, Dec 05, 2003 at 13:20:27 -0500,
Bob Powell <Bo*@hotchkiss.org> wrote:
To whom it may concern,

The following select works fine until I use the CREATE TEMP TABLE AS command because of the matching participant_id's in each table.

SELECT * FROM addresses LEFT OUTER JOIN contacts ON
contacts.participant_id = addresses.participant_id;

Running the select obviously works fine, it's just when I try to create a table when I runn into problems. Do I have to list all of the fields except the one I don't want, or is there another way? Thanks in advance.


You probably want to use an explicit column list instead of * so that
things get associated correctly.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #2
On Fri, Dec 05, 2003 at 13:20:27 -0500,
Bob Powell <Bo*@hotchkiss.org> wrote:
SELECT * FROM addresses LEFT OUTER JOIN contacts ON
contacts.participant_id = addresses.participant_id;

Running the select obviously works fine, it's just when I try to create a
table when I runn into problems. Do I have to list all of the fields
except the one I don't want, or is there another way? Thanks in advance.


You could use USING (participant_id) instead of ON. That only produces a
single participant_id column. It's also less typing.

--
greg
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by anon | last post: by
6 posts views Thread by Bruce | last post: by
2 posts views Thread by Jacob | last post: by
reply views Thread by DrSnap | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.