MySQL写delete语句时不支持表别名

今天写代码时发现了下面一个比较奇怪的问题:

有下面的删除数据的SQL

delete from clinic_commission_info cci  where cci.ID=6;

这个sql本来没有问题,但是在MySQL中执行时会报错

[SQL]delete from clinic_commission_info as cci  where cci.ID=6;
[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 'as cci where cci.ID=6' at line 1

原因是 MySQL写delete语句时不支持表别名,困扰了我一会儿,特此记录。

 

补充:

Oracle数据库执行上面的SQL是没问题的,Oracle写delete语句时支持表别名。

 

参考:

https://blog.csdn.net/yin767833376/article/details/53606652

 

原文地址:

https://www.cnblogs.com/poterliu/p/10083164.html

 

posted @ 2018-12-07 15:28  poterliu  阅读(688)  评论(0编辑  收藏  举报