Thread: Insert values from one existing table into a new table.

Insert values from one existing table into a new table.

From
"Jason"
Date:
I want to insert the existing values of one table into a new table.  It
needs the combination of  these to sql commands:

"  insert into new_table values ( values_of_AtrributeA,
values_of_AttributesB) "
" select AttributeA, AttributeB from some_table "

Thanks for your suggestions!  -- Jason





Re: Insert values from one existing table into a new table.

From
Jeff Eckermann
Date:
Lose the quotes, add a semicolon, and you already have
the correct syntax :-)
--- Jason <jzhu@dental.temple.edu> wrote:
> I want to insert the existing values of one table
> into a new table.  It
> needs the combination of  these to sql commands:
> 
> "  insert into new_table values (
> values_of_AtrributeA,
> values_of_AttributesB) "
> " select AttributeA, AttributeB from some_table "
> 
> Thanks for your suggestions!  -- Jason
> 
> 
> 
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com


Re: Insert values from one existing table into a new table.

From
Jeff Eckermann
Date:
Whoops: should also lose the "values", i.e.:
INSERT INTO new_table (values_of_AttributeA,
values_of_AttributesB)
SELECT AttibuteA, AttributeB
FROM some_table;

--- Jeff Eckermann <jeff_eckermann@yahoo.com> wrote:
> Lose the quotes, add a semicolon, and you already
> have
> the correct syntax :-)
> --- Jason <jzhu@dental.temple.edu> wrote:
> > I want to insert the existing values of one table
> > into a new table.  It
> > needs the combination of  these to sql commands:
> > 
> > "  insert into new_table values (
> > values_of_AtrributeA,
> > values_of_AttributesB) "
> > " select AttributeA, AttributeB from some_table "
> > 
> > Thanks for your suggestions!  -- Jason
> > 
> > 
> > 
> > 
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Find the one for you at Yahoo! Personals
> http://personals.yahoo.com
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please
> send an appropriate
> subscribe-nomail command to majordomo@postgresql.org
> so that your
> message can get through to the mailing list cleanly


__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com