Created
October 12, 2017 06:54
-
-
Save xiuhy/084c57a3986fba042ec7a1ce2839aa58 to your computer and use it in GitHub Desktop.
多表连接 更新 删除
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 多表更新 不能使用 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