Skip to content

Instantly share code, notes, and snippets.

@xiuhy
Created October 12, 2017 06:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xiuhy/6b27845382795e773f531ad33d81f1b7 to your computer and use it in GitHub Desktop.
Save xiuhy/6b27845382795e773f531ad33d81f1b7 to your computer and use it in GitHub Desktop.
多表连接 更新 删除
-- 多表更新 不能使用 limit, order by
update a inner join b on a.col3=b.col3
Set a.col1=b.col1,a.col2=b.col2
Where 。。。。。
-- 多表删除可以使用select 中所有类型的联合,也可以使用 left join ,或者inner join,或者right join
DELETE t1, t2 FROM t1, t2, t3 WHERE t1.id=t2.id AND t2.id=t3.id;
或:
DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.id=t2.id AND t2.id=t3.id;
--删除 jiabieming加别名
delete alias from tableName alias where alias.xxx=xxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment