1. 程式人生 > >MySQL寫delete語句時不支援表別名

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

聯絡郵箱:[email protected]

聯絡微信:poterliu

或者掃二維碼