执行此 MySql 查询时:
update order_line_item oli
inner join orders o
set oli.active_orders = o.valid
where oli.order_id = o.id
我不断收到此错误:
SQL 错误 (1292):截断不正确的 DOUBLE 值:'6893Order'
有什么建议么?
附加信息:
- "active_orders" 和 "valid" 都是 INT
- order_line_item 可以为多行引用相同的 order.id
表格示例(当前)
table : order_line_item id order_id active_orders 1 1 2 2 3 3 4 4 5 4 table : orders +-------+-------------+ | id | valid | +-------+-------------+ | 1 | 1 | | 2 | 1 | | 3 | 0 | | 4 | 1 | | 5 | 1 | +-------+-------------+
通过查询,我尝试复制 orders.valid 并粘贴到 orders_line_item.active_orders:
table : order_line_item +-------+------------+-----------------+ | id | order_id | active_orders | +-------+------------+-----------------+ | 1 | 1 | 1 | | 2 | 2 | 1 | | 3 | 3 | 0 | | 4 | 4 | 1 | | 5 | 4 | 1 | +-------+------------+-----------------+ table : orders +-------+-------------+ | id | valid | +-------+-------------+ | 1 | 1 | | 2 | 1 | | 3 | 0 | | 4 | 1 | | 5 | 1 | +-------+-------------+