Thread: select into...
Hi Everybody,
I want to execute a query below:
select *
into my_table
from old_table
where (some_condition);
The trouble is that the manual page states that this would
"SELECT INTO creates a new table and fills it with data
computed by a query."
What I want is to append my_table. Is there any way to
get postgres to do what I want done?
Thank you in advance.
Regards,
Tena Sakai
tsakai@gallo.ucsf.edu
On Mon, Mar 16, 2009 at 5:08 PM, Tena Sakai <tsakai@gallo.ucsf.edu> wrote: > Hi Everybody, > > I want to execute a query below: > > select * > into my_table > from old_table > where (some_condition); > > The trouble is that the manual page states that this would > "SELECT INTO creates a new table and fills it with data > computed by a query." > > What I want is to append my_table. Is there any way to > get postgres to do what I want done? You want insert: insert into my_table select yada from old_table;
>>> "Tena Sakai" <tsakai@gallo.ucsf.edu> wrote: > What I want is to append my_table. Is there any way > to get postgres to do what I want done? PostgreSQL supports the SQL standard syntax for this: insert into my_table select * from old_table where (some_condition); -Kevin
Many thanks, Scott.
Tena Sakai
-----Original Message-----
From: Scott Marlowe [mailto:scott.marlowe@gmail.com]
Sent: Mon 3/16/2009 4:12 PM
To: Tena Sakai
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] select into...
On Mon, Mar 16, 2009 at 5:08 PM, Tena Sakai <tsakai@gallo.ucsf.edu> wrote:
> Hi Everybody,
>
> I want to execute a query below:
>
> select *
> into my_table
> from old_table
> where (some_condition);
>
> The trouble is that the manual page states that this would
> "SELECT INTO creates a new table and fills it with data
> computed by a query."
>
> What I want is to append my_table. Is there any way to
> get postgres to do what I want done?
You want insert:
insert into my_table select yada from old_table;
Thank you, Fernando.
Thank you, Kevin.
Regards,
Tena Sakai
tsakai@gallo.ucsf.edu
-----Original Message-----
From: Fernando Arancibia [mailto:farancibia@iswitch.cl]
Sent: Mon 3/16/2009 4:13 PM
To: Tena Sakai
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] select into...
Hi, try
insert into my_table select * from old_table where (some_condition);
bye
Fernando.
2009/3/16 Tena Sakai <tsakai@gallo.ucsf.edu>
> Hi Everybody,
>
> I want to execute a query below:
>
> select *
> into my_table
> from old_table
> where (some_condition);
>
> The trouble is that the manual page states that this would
> "SELECT INTO creates a new table and fills it with data
> computed by a query."
>
> What I want is to append my_table. Is there any way to
> get postgres to do what I want done?
>
> Thank you in advance.
>
> Regards,
>
> Tena Sakai
> tsakai@gallo.ucsf.edu
>
>
Hi Everybody,
I want to execute a query below:
select *
into my_table
from old_table
where (some_condition);
The trouble is that the manual page states that this would
"SELECT INTO creates a new table and fills it with data
computed by a query."
What I want is to append my_table. Is there any way to
get postgres to do what I want done?
Thank you in advance.
Regards,
Tena Sakai
tsakai@gallo.ucsf.edu