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

How to select all columns and insert into other table

From
A B
Date:
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?

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

From
Jayadevan M
Date:


From:        A B <gentosaker@gmail.com>
To:        pgsql-novice@postgresql.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@postgresql.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."