update file1 set (field1, field2, field3) = (select field1, field2, field3 from file2 where....) Mark Mark Walter Sr. Programmer/Analyst Hanover Wire Cloth a div of CCX, Inc. email@example.com http://www.hanoverwire.com 717.637.3795 Ext.3040 "Leland, David" <dleland@Harter.com To: "'firstname.lastname@example.org'" <email@example.com> > cc: Sent by: Subject: SQL update midrange-l-admin@mi drange.com 01/10/02 11:28 AM Please respond to midrange-l This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. -- [ Picked text/plain from multipart/alternative ] I know how to update a field in one file with data from another file using SQL. But, I need to update more than one field now. I vaguely recall seeing a "trick" like that somewhere but don't recall where. Anyone know how to accomplish this? What I tried is the following: update file1 a set field1, field2 = (select field3, field4 from file2 b where a.key1 = b.key2) where exists (select * from file2 b where a.key1 = b.key2) Dave _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l or email: MIDRANGE-Lfirstname.lastname@example.org Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.