| From: | Michael Glaesemann <michael(dot)glaesemann(at)myyearbook(dot)com> | 
|---|---|
| To: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> | 
| Cc: | Michael Glaesemann <michael(dot)glaesemann(at)myyearbook(dot)com>, pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: Copying data from one table to another - how to specify fields? | 
| Date: | 2011-03-09 14:05:39 | 
| Message-ID: | 2094090E-7A4F-4665-9EBD-FF701E9421F9@myyearbook.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On Mar 9, 2011, at 08:47 , Alexander Farber wrote:
> Hello,
> 
> I'm using CentOS 5.5 with PostgreSQL 8.4.7 and
> am migrating my site from phpBB 3 to Drupal 7.
> 
> 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_lastvisit
    FROM phpbb_users
    WHERE user_id > 50;
<http://www.postgresql.org/docs/9.0/interactive/sql-insert.html>
Michael Glaesemann
michael(dot)glaesemann(at)myyearbook(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Vibhor Kumar | 2011-03-09 14:10:06 | Re: FW: backup using pg_dump postgreSQL 8.3.8 | 
| Previous Message | Sandy Test | 2011-03-09 13:58:20 | FW: backup using pg_dump postgreSQL 8.3.8 |