table1 と table2 の値が等しい場合、table1 の行を更新する方法を知りたいです。
たとえば、table1 には次の行があります。
id - password - attemp
user secret 0
user2 pass 0
およびtable2には行があります"
id - password
user secret
user2 kek
table1 ユーザーとパスワードが等しく、table1 attemp = 0 の table1 attemp 値を table1 attemp = 1 に更新します。
私はこのようなことをしました(そしてそれはうまくいきません):
UPDATE a1
set a1.attemp = '1'
from table1 a1
JOIN table2 a2
on a1.user = a2.user AND a1.password = a2.password
WHERE
a1.attemp != 1