Re: Copying data from one table to another - how to specify fields?
В списке pgsql-general по дате отправления:
| От | Andrew Sullivan |
|---|---|
| Тема | Re: Copying data from one table to another - how to specify fields? |
| Дата | |
| Msg-id | 20110309141226.GJ32629@shinkuro.com обсуждение |
| Ответ на | Copying data from one table to another - how to specify fields? (Alexander Farber <alexander.farber@gmail.com>) |
| Список | pgsql-general |
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
ajs@crankycanuck.ca
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера