Re: INSERTS and Queries

Поиск
Список
Период
Сортировка
От Bill Moran
Тема Re: INSERTS and Queries
Дата
Msg-id 4043411E.3070401@potentialtech.com
обсуждение исходный текст
Ответ на INSERTS and Queries  ("C G" <csgcsg39@hotmail.com>)
Список pgsql-general
C G wrote:
> Dear All,
>
> I can use insert with 'select' if I do this
>
> INSERT INTO TABLE t1 (col1) SELECT stuff FROM t2;
>
> But I want to insert more than one thing into the table, e.g.
>
> INSERT INTO TABLE t1 (col1,col2) SELECT stuff FROM t2 , 100;
>
> Any ideas on how I would achieve this?

INSERT INTO TABLE t1 (col1, col2) SELECT stuff, morestuff FROM t2;

If you want to instert some constant:

INSERT INTO TABLE t1 (col1, col2) SELECT stuff, 100 FROM t2;

--
Bill Moran
Potential Technologies
http://www.potentialtech.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Nick Barr
Дата:
Сообщение: Re: INSERTS and Queries
Следующее
От: scrappy@PostgreSQL.org
Дата:
Сообщение: stacy