|
I want to use an SQL update statement to make a field in a file match a field in the associated file record. A crib sheet I found online shows 2 ways to do it: update TableOne inner join TableTwo on TableOne.commonID = TableTwo.commonID set TableOne.field1 = TableTwo.fieldX Or: update TableOne, TableTwo set TableOne.field1 = TableTwo.fieldX where TableOne.commonID = TableTwo.commonID Is there a preference in picking one of these? For example, the 2nd one says "update" for both table names even though only one is actually being updated. Will there be some inefficiency here because of that? Like some unneeded lock on the file? Or is the SQL engine smart enough that it will "Read Everything Before Doing Anything" and handle it the same as the first? Thanks for any insight.
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.