Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux