我想这与MySQL:
DELETE FROM `contact_hostcommands_relation` AS `ContactHostCommand` WHERE (`ContactHostCommand`.`chr_id` = 999999) LIMIT 1
而我得到这个:
#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 (`ContactHostCommand`.`chr_id` = 999999) LIMIT 1' at line 1
注意:是自动生成的查询,条件是基于表的别名。
为什么我得到这个错误?
有没有办法使用WHERE子句中的表的别名?
这是MySQL的具体点吗?
您可以使用SQL这样的:
DELETE FROM ContactHostCommand
USING `contact_hostcommands_relation` AS ContactHostCommand
WHERE (ContactHostCommand.`chr_id` = 999999)
LIMIT 1
@Matus和@CeesTimmerman说一下MSSQL什么,工作在MySQL的73年5月1日太:
delete <alias> from <table> <alias> where <alias>.<field>...
不能使用AS
的DELETE
与MySQL条款:
DELETE FROM `contact_hostcommands_relation` WHERE (`chr_id` = 999999) LIMIT 1
文章来源: DELETE FROM `table` AS `alias` … WHERE `alias`.`column` … why syntax error?