RE: [GENERAL] insert problem.

Поиск
Список
Период
Сортировка
От Jackson, DeJuan
Тема RE: [GENERAL] insert problem.
Дата
Msg-id F10BB1FAF801D111829B0060971D839F4D72E4@cpsmail
обсуждение исходный текст
Список pgsql-general
> Hi,
>
>  I've got this little problem:
> I've got two relations:
> groups(name text); -- This one contains the name of usergroups;
> users (username text, groupid oid, constraint grid primary
> key(username));
> -- The users relation contains the name of the users along with the
> group
> relation's oid as a foreign key.
> I'd like to insert a new user and I also know the group's he or she
> belongs to:
>
> elmu=> insert into users values('Average Joe', (select oid from groups
> where groups.name='grp1'));
> ERROR:  parser: parse error at or near "select"
>
> What's wrong with the insertion?
try:
 insert into users
 select 'Average Joe', oid
   from groups
  where name = 'grp1';
    -DEJ

>             Thanks in advance
>
> ----------------------------------------------------------------------
> ----------
> Sebestyén Zoltán AKA Memphisto        It all seems so stupid,
>                     it makes me want to give up.
> szoli@netvisor.hu            But why should I give up,
>                                         when it all seems so stupid?
>
> MAKE INSTALL NOT WAR            And please avoid Necrosoft
> Widows
>
>

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

Предыдущее
От: A James Lewis
Дата:
Сообщение: Epoch Time, conversion?
Следующее
От: "Jackson, DeJuan"
Дата:
Сообщение: RE: [GENERAL] age('now',date::datetime)