Re: Updating with a subselect

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Updating with a subselect
Дата
Msg-id 20080423084216.GB16761@svana.org
обсуждение исходный текст
Ответ на Updating with a subselect  ("Leandro Casadei" <mateamargo@gmail.com>)
Список pgsql-general
On Tue, Apr 22, 2008 at 01:17:42PM -0300, Leandro Casadei wrote:
> Hi, I need to update a field from a table based in a count.
>
> This is the query:

I don't know why your given query doesn't work, but you could simplify
it which may help.

> update    shops
> set    itemsqty =
>     (
>     select     count(*)
>     from     items i1
>     where  i1.shopid = s0.shopid
>     )
> from     shops s0

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

Вложения

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