MySQL資料庫delete資料時不支援表別名

來源:互聯網
上載者:User

MySQL資料庫delete資料時不支援表別名

今天在幫同事查看一條刪除的SQL語句執行出錯的問題

  SQL語句如下:

DELETE FROM LEAD_SYSTEM_MENU_ORG_REF as t WHERE t.resourceid='4028812348f28b890148f29253a80000'

這條SQL語句放到Oracle資料庫中去執行是可以正常執行的,但是放到MySQL資料庫中執行時就出現了如下的錯誤:

[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 'WHERE t.resourceid='4028812348f28b890148f29253a80000'

  看到"SQL syntax"就知道SQL執行錯誤的原因是SQL文法不對,這就比較奇怪了,這條刪除的SQL橫看豎看都沒有問題呀,Oracle能夠正常執行,為什麼MySQL卻不行呢,上網查了一下原因,原來是MySQL資料庫delete資料時,不支援表別名,這個問題以前也沒有注意到,在此記錄一下。

本文永久更新連結地址:

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.