類似于:SQL server : update a set a.id =b.id from table_1 a inner join table_2 on a.name=b.name的寫法么SQL server : update a set a.id =b.id from table_1 a inner join table_2 b on a.name=b.name改下這個Sql哈,,但是為什么不能在sqlite里執行呢。。求大神指點
1 回答

元芳怎么了
TA貢獻1798條經驗 獲得超7個贊
Update ...From(Cross Join in Update):Sqlite 不支持類似
“UPDATE tbl1 SET col2 = tbl2.col2
FROM table1 tbl1 INNER JOIN table2 tbl2 ON tbl1.col1 = tbl2.col1”
的update,替代的解決辦法是:
UPDATE table1 SET col2 = (select col2 from table2 where table2.col1=table1.col1 limit 1)
where exists(select * from table2 where table2.col1=table1.col1);
- 1 回答
- 0 關注
- 2196 瀏覽
添加回答
舉報
0/150
提交
取消