Search Postgresql Archives

Re: Update sql question

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

 



Don Isgitt wrote:

gds2=# update master set operator=(select coalesce(newopr,master.operator) from opr_match where state=master.state and oldopr=master.operator limit 1) where state='NM' and operator is not null;

What am I doing wrong that gives me the 261 null operator fields after the update?

Hmm - haven't tested this, but what would happen if the subselect returned no matches? Quickest test is probably to add a dummy value to the coalesce and see if that takes the place of the 261 nulls. If it doesn't, the subselect isn't matching for those rows.
--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

              http://archives.postgresql.org

[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