I've used the syntax, UPDATE ... LEFT JOIN a few times in the past, and
today I used it again for a new employer that I work for.

Several of my associates were unaware that the UPDATE ... LEFT JOIN
syntax is valid in MySQL. After I demonstrated that the query does
indeed work fine on our MySQL 5.x server, one associate proposed the
possibility that by performing an UPDATE ... LEFT JOIN, you could
possibly be locking more than just the table being written to.

 

I.E -

UPDATE

            Table1 t1

            LEFT JOIN Table2 t2 USING (field1)

SET

            t1.field2 = '1'

WHERE

            t1.field2 = '0'

 

 

Now, my actual query was more useful than the example I wrote above, but
my question is, would Table2 be locked, even though it is only being
read from, not written to?

 

Any assistance on this matter would be of great assistance, and would
determine whether I'll continue to use this update structure.

 

Many thanks!

 

RED VENTURES

Jonathan Langevin
PHP Developer (Home Services Corp)
14120 Ballantyne Corporate Place
Suite 200
Charlotte, NC  28277
Tel: 704-971-4373
Fax: 704-971-2303
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

 

Reply via email to