gpt4 book ai didi

mysql - DELETE FROM `table` AS `alias` ... WHERE `alias` .`column` ... 为什么语法错误?

转载 作者:IT老高 更新时间:2023-10-28 23:43:16 24 4
gpt4 key购买 nike

我用 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 特有的吗?

最佳答案

@Matus 和 @CeesTimmerman 所说的关于 MSSQL 的内容也适用于 MySQL 5.1.73:

delete <alias> from <table> <alias> where <alias>.<field>...

关于mysql - DELETE FROM `table` AS `alias` ... WHERE `alias` .`column` ... 为什么语法错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10484532/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com