[GENERAL] Update sql question

2005-06-07 Thread Don Isgitt
Hello, First, software info: gds2=# select version(); version

Re: [GENERAL] Update sql question

2005-06-07 Thread Richard Huxton
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

Re: [GENERAL] Update sql question

2005-06-07 Thread Tom Lane
Don Isgitt [EMAIL PROTECTED] writes: 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; I think what you want is gds2=# update master set

Re: [GENERAL] Update sql question

2005-06-07 Thread Don Isgitt
Tom Lane wrote: Don Isgitt [EMAIL PROTECTED] writes: 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; I think what you want is gds2=#

Re: [GENERAL] Update sql question

2005-06-07 Thread Tom Lane
Don Isgitt [EMAIL PROTECTED] writes: Tom Lane wrote: BTW, I find the limit 1 a bit scary --- if there are multiple matches, this coding will select a random one of them. Is that really what you want? Ah, quite so. Thank you, Tom and Richard for your spot on help. Tom, I appreciate your

Re: [GENERAL] UPDATE sql question

2003-08-01 Thread Ron Johnson
On Mon, 2003-07-28 at 03:24, Andrei Verovski wrote: Hi, What exactly will happen if UPDATE sql statement instructs to update some columns with the same values as already in the database? Will Postgres update only different values or it will simply modify all columns listed in UPDATE sql?