Update XXX set XXX where 这种写法大家肯定都知道,才发现update和delete居然支持inner join的update方式,太神奇了。
update的格式是
update t1 set t1.name=’Liu’ from t1 inner join t2 on t1.id = t2.tid
delete 语句也是类似
delete from t1 from t1 inner join t2 on t1.id = t2.tid
注意绿色部分。
2023-10-12 23:49:10
Update XXX set XXX where 这种写法大家肯定都知道,才发现update和delete居然支持inner join的update方式,太神奇了。
update的格式是
update t1 set t1.name=’Liu’ from t1 inner join t2 on t1.id = t2.tid
delete 语句也是类似
delete from t1 from t1 inner join t2 on t1.id = t2.tid
注意绿色部分。