我有如下查询
INSERT INTO connections (`c_id`,`in`,`out`,`ip`,`userID`)
VALUES (
(
SELECT c_id
FROM connections
WHERE (a bunch of conditions)
ORDER BY c_id DESC LIMIT 1
),
'1373799802',
0,
INET_ATON('127.0.0.1'),
4
)
ON DUPLICATE KEY UPDATE `out` = 1
引发以下错误
1093 - 您不能在 FROM 子句中为更新指定目标表“连接”
显然,我不能在insert into on duplicate update
语法中包含 SELECT 子句,但我真的宁愿这样做,而不是运行 2 个查询。谁能告诉我我该怎么做?