关于mysql delete语句中的别名使用

来源:互联网 发布:作品集 知乎 编辑:程序博客网 时间:2024/05/16 09:42

一直使用oracle数据库,别名只需要放在表名后即可使用,今天使用mysql数据库delete语句这里除了错

语句:delete from syscode s where s.FID=2

错误信息:[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's where s.FID=2' at line 1


在网上找了半天,发现mysql数据库中delete语句别名有固定用法

delete [alias] from [table] [alias] where [alias].[field]...

别名需要在delete和from之间出现一次,同时表名后也要加上别名,点了一下就出来了....


多表之间同样:

delete a,b from ab01 a,ab02 b where a.AAB101=b.AAB101