Re: [SQL] INSERT and SELECT

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

    Because  VALUES  and  SELECT  are  mutually exclusive at that
    point.

    Just do INSERT INTO table SELECT ...

    or INSERT INTO TABLE (attrib, ...) SELECT ...

    and the parser should be happy.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #

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

Предыдущее
От: "Ross J. Reedstrom"
Дата:
Сообщение: Re: [SQL] INSERT and SELECT
Следующее
От: neko@kredit.sth.szif.hu
Дата:
Сообщение: Re: [SQL] INSERT and SELECT