|
I wish to thank those who responded to my original post and, as always happens on this list, provided valuable input to the solution of my problem. Many of the suggested methods work fine and now I'm left with deciding which one should I use (life's hard). I'm clearly not an SQL wizard, but the syntaxes that make more sense to my shallow mind are the two suggested by Charles: Assign some other value instead of NULL to #5 1) update PROJECT A set A.EMPNAM = coalesce((select B.NAME from EMPMASTER B where A.EMPCDE = B.CODE ) , A.EMPNAM ) 2) don't update #5 at all update PROJECT A set A.EMPNAM = (select B.NAME from EMPMASTER B where A.EMPCDE = B.CODE ) Where A.EMPCDE in (Select C.CODE FROM EMPMASTER C ) (I'll probably end up using option 2 simply because is closer to my way of thinking as an RPG programmer). The method suggested by ebudimlic@xxxxxxxxxxxxxxxxxxxxxxxxx also works fine: update PROJECT A set A.EMPNAM = (select B.NAME from EMPMASTER B where A.EMPCDE = B.CODE) WHERE EXISTS (select 1 from EMPMASTER B where A.EMPCDE = B.CODE) although I have some difficulties understanding that "select 1" As far as the indications from Rob, I haven't really tried because they use inner joins and look to me more complex than the others. Many thanks again. Valerio Vincenti IT Business Analyst County of Spotsylvania, I.S. Department Spotsylvania, VA 22553 Phone (540) 507-7507 Fax (540) 582-9841 e-mail: vvincenti@xxxxxxxxxxxxxxxxxx
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.