- You can't specify target table 'act_ge_bytearray' for update in FROM clause
时间: 2024-03-08 09:30:46 浏览: 66
这个问题通常是由MySQL的语法限制引起的。可以通过子查询解决这个问题。例如,使用以下查询可以避免这个错误:
UPDATE act_ge_bytearray SET bytes_ = (SELECT bytes_ FROM (SELECT * FROM act_ge_bytearray) AS tmp WHERE id_ = 'some_id') WHERE id_ = 'some_id';
这个查询将act_ge_bytearray表的\"bytes_\"字段更新为具有指定id_的行的值。
相关问题
You can t specify target table res_device_info for update in FROM clause
This error message usually occurs in SQL when you try to update a table that is also used in the FROM clause of the same query. To resolve this issue, you can use a subquery to update the table instead. Here's an example:
```sql
UPDATE res_device_info
SET column_name = new_value
WHERE device_id IN (
SELECT device_id
FROM res_device_info
WHERE condition
);
```
In this example, you can replace `column_name`, `new_value`, `condition` with the appropriate values for your scenario. Make sure to adjust the subquery's condition to match your requirements.
1093 - You can't specify target table 't_app_interface_log' for update in FROM clause
这个错误是MySQL数据库中的一个常见错误,它通常发生在你试图在一个查询中更新一个表,并且这个表也被用作查询的源表时。具体来说,错误信息 "You can't specify target table 't_app_interface_log' for update in FROM clause" 表示你不能在FROM子句中指定目标表 't_app_interface_log' 来进行更新操作。
这个错误的原因是MySQL不允许在同一个查询中同时使用目标表和源表。为了解决这个问题,你可以使用子查询来创建一个临时表,然后再更新目标表。下面是一个示例:
```
UPDATE t_app_interface_log
SET column1 = value1
WHERE id IN (
SELECT id
FROM (
SELECT id
FROM t_app_interface_log
WHERE condition
) AS temp_table
);
```
在这个示例中,我们使用子查询创建了一个临时表 temp_table,然后在更新语句中使用了这个临时表来指定要更新的行。
阅读全文
相关推荐














