我有这样的sql:
UPDATE "user_login a"
LEFT OUTER JOIN "p_pegawai b"
ON a.id_pegawai = b.id
SET a.password = 'Keluarga1'
WHERE b.NIP = '195812'
我试过这个:
MySql Update A Joined Table
但它总是给我错误
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"user_login a" LEFT OUTER JOIN "p_pegawai b" ON a.id_pegawai = b.id SET a.passw' at line 1
我使用的是 MariaDB,而不是 Mysql,我的查询会出现什么问题?
最佳答案
在 MySQL 中使用反引号但不要将它们应用于组合表和别名,它们必须被视为单独的项目
UPDATE `user_login` a
LEFT OUTER JOIN `p_pegawai` b
ON a.id_pegawai = b.id
SET a.password = 'Keluarga1'
WHERE b.NIP = '195812'
关于sql - 如何在 MariaDB 中更新基于连接表的行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47546152/