update file1 set (field1, field2, field3) = (select field1, field2, field3
from file2 where....)


Mark Walter
Sr. Programmer/Analyst
Hanover Wire Cloth a div of CCX, Inc.
717.637.3795 Ext.3040

                    "Leland, David"
                    <dleland@Harter.com        To:     
"'midrange-l@midrange.com'" <midrange-l@midrange.com>
                    >                          cc:
                    Sent by:                   Subject:     SQL update

                    01/10/02 11:28 AM
                    Please respond to

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 =

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-L-request@midrange.com
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.

This thread ...

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 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.