Re: UPDATE with JOIN

Поиск
Список
Период
Сортировка
Искать
От
Keith Worthington
Тема
Re: UPDATE with JOIN
Дата
в 17:31:21
Msg-id
20050524202906.M48823@narrowpathinc.com
Ответ на
Список
Дерево обсуждения
UPDATE with JOIN "Keith Worthington" <keithw@narrowpathinc.com>
Re: UPDATE with JOIN Tom Lane <tgl@sss.pgh.pa.us>
Re: UPDATE with JOIN "Keith Worthington" <keithw@narrowpathinc.com>
Re: UPDATE with JOIN "Keith Worthington" <keithw@narrowpathinc.com>
On Tue, 24 May 2005 14:26:21 -0400, Tom Lane wrote
> "Keith Worthington"  writes:
> > UPDATE tbl_line_item
> >    SET tbl_line_item.reviewed = TRUE
> >   FROM tbl_item
> >     ON ( tbl_line_item.item_id = tbl_item.id )
> >  WHERE item_type = 'DIR';
> 
> Of course that's not valid JOIN syntax (no JOIN keyword, and no 
> place to put it either).  You have to use the WHERE clause:
> 
> UPDATE tbl_line_item
>    SET tbl_line_item.reviewed = TRUE
>   FROM tbl_item
>  WHERE tbl_line_item.item_id = tbl_item.id
>        AND item_type = 'DIR';
> 
> 			regards, tom lane
> 

Thanks Tom

I couldn't figure out how to do the JOIN part of that statement.  Using your
instruction all I had left to do was drop the qualification off the SET column
and it worked.  :-)  Thanks again.

UPDATE tbl_line_item
   SET reviewed = TRUE
  FROM tbl_item
 WHERE tbl_line_item.item_id = tbl_item.id
   AND item_type = 'DIR';

Kind Regards,
Keith
В списке pgsql-novice по дате отправления
От: Jeff Eckermann
Дата:
От: Ramon Orticio
Дата:
Сообщение: posgres files
FAQ