By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,811 Members | 1,978 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,811 IT Pros & Developers. It's quick & easy.

CREATE TABLE AS COMMAND

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.