How to do an update with a join??
Posted in 1993
---- original message from Eric Thompson ---- + (Using ISQL 4.10 on a DG/UX box) + + EXAMPLE: Table A has many columns two of which are "ss_number" and "name". + Table B has ONLY two columns, which are "ss_number" and "name". Table + B contains updated name information for a portion of the rows in table A. + How can I tell Informix to update the names in Table A from Table where + the ss_numbers are the same? This doesn't work (obviously) but it seems + like I should be able to do something like this: + + update A + set A.name = B.name + where A.ss_number = B.ss_number + + thanks for any help, + Eric + thompson@netcom.com Try this: update A set A.name = (select B.name from B where A.ss_number = B.ss_number) -- Jerry M. Denman -- Director of Technical Services 4gen!warlok!jerry Sherwood Systems (a division of Sherwood Mfg Co. Inc.) jerry@sherwood.com 4760 N. Central Phone:(602) 230-8188 Phoenix AZ, 85012 FAX:(602) 230-9491 ------------------------------------------------------------------------------ More harder stuff faster, with less good people and it's got to be more right -- Bill Orr, Informix Software