Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I suspect you have nulls somewhere. Also I have added some parens that you shouldn't need, but just to cover the bases.

Does this work?

UPDATE "addresses" SET "AREACODE" = (SELECT ifnull("AREACODE",'missing area code') FROM "tnumbers" WHERE (ifnull("addresses"."ID",0) = "tnumbers"."ID") AND (ifnull("tnumbers"."city",0) = 'OMAHA') )

I suspect you have nulls somewhere. Also I have added some parens that you shouldn't need, but just to cover the bases.

Does this work?

UPDATE "addresses"  SET "AREACODE" = (SELECT ifnull("AREACODE",'missing area code')  FROM "tnumbers"  WHERE (ifnull("addresses"."ID",0) (
  (ifnull("addresses"."ID" ,0) = "tnumbers"."ID") AND  (ifnull("tnumbers"."city",0) = 'OMAHA') )

'OMAHA' ) )

[Edit: I suspect you have nulls somewhere. think Ratslinger's answer is better. Also I have added some parens that you shouldn't need, but just to cover the bases.

Does Also I forgot an important paren in my original answer here. Fixed below.

My only tips at this work?point, is to please pretty print your SQL in some way like this, so it's easier for everyone to QUICKLY see what's going on.]

UPDATE "addresses" 
  SET "AREACODE" = (SELECT (
        SELECT ifnull("AREACODE",'missing area code') 
 FROM "tnumbers" 
 WHERE (
   (ifnull("addresses"."ID" ,0) = "tnumbers"."ID") AND 
   (ifnull("tnumbers"."city",0) = 'OMAHA'        ) 
    )
)