Re: sql update comand syntax
Posted in 1994
In article <dberg.779838968@puma>, David I. Berg <dberg@informix.com> wrote: > UPDATE award > SET award.AWARD_AMOUNT = award.AWARD_AMOUNT + award.CARRY_FORWARD > WHERE award.AWARD_ACCOUNT = > (SELECT mod.MOD_ACCOUNT FROM mod > WHERE mod.MOD_PROCESSING IN ("2X","CL")) Ok, most of us figure out that you need to use a sub-query when doing updates and deletes that depend on data in another table. This works fine when using only a single column join (match, comparison, whatever). However, what should you do when you have a multicolumn key? select foo.* from foo, bar where foo.item = bar.item and foo.rev = bar.rev update foo set whatever where item ??? and rev ??? You could use two sub-queries, perhaps (I don't know). I've done it with rowids, but this seems ill-advised. One method I tried was to use the concatenation operator "||" to paste together the two columns: update foo set whatever where item || rev in (select item || rev from bar) This works, but seemed rather slow. Is there a better way, something I've overlooked? -- Rodger Anderson