Re: How to select all columns and insert into other table

From: Jayadevan M <Jayadevan(dot)Maymala(at)ibsplc(dot)com>
To: pgsql-novice(at)postgresql(dot)org, pgsql-novice-owner(at)postgresql(dot)org
Subject: Re: How to select all columns and insert into other table
Date: 2010-02-18 10:13:28
Message-ID: OFBB8D044F.CB1B4C92-ON652576CE.00380D1E-652576CE.00382A7C@ibsplc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

From: A B <gentosaker(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Date: 02/18/2010 03:38 PM
Subject: [NOVICE] How to select all columns and insert into other
table
Sent by: pgsql-novice-owner(at)postgresql(dot)org

Hello.

If tableA and tableB have the same columns but in differrent order

Is there a way to get

INSERT INTO tableA SELECT * FROM tableB LIMIT 1;

to work, that is, get the value in column X to be placed in the
corresponding column in tableA without listing all the columns?

Create a view on the source table with columns listed in the necessary
order and use the view?

Regards,
Jayadevan

DISCLAIMER:

"The information in this e-mail and any attachment is intended only for
the person to whom it is addressed and may contain confidential and/or
privileged material. If you have received this e-mail in error, kindly
contact the sender and destroy all copies of the original communication.
IBS makes no warranty, express or implied, nor guarantees the accuracy,
adequacy or completeness of the information contained in this email or any
attachment and is not liable for any errors, defects, omissions, viruses
or for resultant loss or damage, if any, direct or indirect."

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message dipti shah 2010-02-18 10:23:54 Re: Define permissions at database level
Previous Message A B 2010-02-18 10:10:32 How to select all columns and insert into other table