saat Anda menggunakan tabel kunci, Anda perlu mengunci semua tabel di kueri Anda. Saat Anda menggunakan subkueri, itu membuat tabel. dan Anda tidak menguncinya. karena itu Anda mendapatkan kesalahan.
referensi:http://dev.mysql.com/doc /refman/5.0/en/lock-tables.html
berikan alias ke tabel bagian dalam
sampel yang diuji:
lock tables products as p1 write, products as p2 write ;
select product_id from products as p1
where product_id not in (
select product_id from products p2 where product_id in (1,2)
)
Dan mungkin Anda perlu ini:
lock tables radcheck as r1 write, radcheck as r2 write ;
SELECT * FROM radcheck r1 WHERE id NOT IN (
SELECT id FROM (
SELECT id FROM radcheck r2 WHERE attribute = 'Password' GROUP BY UserName HAVING COUNT(*) > 1) AS c
);