类似于: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 关注
- 2146 浏览
添加回答
举报
0/150
提交
取消