On Wed, Mar 09, 2011 at 02:47:46PM +0100, Alexander Farber wrote:
> I would like to copy these fields from one table:
> 
>   select user_id, username, user_email, user_regdate, user_lastvisit
> from phpbb_users where user_id > 50;
> 
> into the other (already existing) table:
> 
>   select uid, name, mail, created, access from drupal_users;
> 

INSERT INTO drupal users (uid, name, mail, created, access) 
       SELECT user_id, username, user_email, user_regdate, user_lastvist
         FROM phpbb_users where user_id > 50;

This is sort of like an example on
http://www.postgresql.org/docs/9.0/interactive/sql-insert.html, but
that example uses SELCT *.  Perhaps an additional example would have
helped?  (This is basic SQL, though, and I'm not sure the keyword
manual is the best place for such an example.)

A

-- 
Andrew Sullivan
a...@crankycanuck.ca

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to