Re: more than one row returned by a subquery used as an

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: more than one row returned by a subquery used as an
Дата
Msg-id 434FAB40.8070103@magproductions.nl
обсуждение исходный текст
Ответ на more than one row returned by a subquery used as an expression  (CSN <cool_screen_name90001@yahoo.com>)
Список pgsql-general
CSN wrote:
> I'm trying to get this query to work:
>
> update sectors set companies =(select companies from
> industries where sector_id =sectors.id);

Try these instead:

update sectors
    set companies = industries.companies
   from industries
  where industries.sector_id =sectors.id;

update industries
    set companies = count(companies.id)
   from companies
  where industry_id = industries.id;

--
Alban Hertroys

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

Предыдущее
От: "Rick Schumeyer"
Дата:
Сообщение: problem converting from 8.0.4 to 8.1beta3: character encoding
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Postgres logs to syslog LOCAL0