Re: [SQL] INSERT and SELECT

Поиск
Список
Период
Сортировка
От Eric BARROCA
Тема Re: [SQL] INSERT and SELECT
Дата
Msg-id 87emcuu4f4.fsf@venus.fondation
обсуждение исходный текст
Ответ на Re: [SQL] INSERT and SELECT  (Stuart Rison <rison@biochemistry.ucl.ac.uk>)
Ответы Re: [SQL] INSERT and SELECT  (wieck@debis.com (Jan Wieck))
Список pgsql-sql
Stuart Rison <rison@biochemistry.ucl.ac.uk> writes:
> INSERT INTO table VALUES SELECT oid, 'test' FROM membre WHERE
> email="toto@toto.com";
I've tried it, but it doesn't work too ("paser error near or at select"),
even if I replace " by '.

The sample table "table" :- ID int4- login varchar()- password varchar()

I'd like to put into the ID culumn the result of (SELECT ...), into the
login column "test" and into the password one "testpass".

I've tried many queries like :

INSERT INTO table (id, login, password) VALUES SELECT oid, 'test',
'testpass' FROM membre WHERE email='toto@toto.com';

or

INSERT INTO table (id, login, password) VALUES ((SELECT oid FROM membre
WHERE email='toto@toto.com'), 'test', 'testpass'); 

or 

INSERT INTO table (id, login, password) VALUES (SELECT oid, 'test',
'testpass' FROM membre WHERE email='toto@toto.com');

...

But nothing give me a result. I get always parse error near select, and I
can't figure why.


Best Regards,

Éric.


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

Предыдущее
От: Vladimir Terziev
Дата:
Сообщение: Re: [SQL] INSERT and SELECT
Следующее
От: "Nikolay Mijaylov"
Дата:
Сообщение: Re: [SQL] INSERT and SELECT