有些人可以帮我解决这个问题吗
UPDATE
LoadBal_WebAPI_RequestDetails
SET
status='vamsi'
WHERE
requestID in (select `lb`.`requestId` AS `requestID` from (`LoadBal_WebAPI_RequestDetails` `lb` join `Global_AR_Processes` `ar` on((`ar`.`processId` = `lb`.`processRegistryId`))) where ((`lb`.`status` = 'Received') and (`ar`.`isProcessAvailable` = 1)) order by `lb`.`lastUpdatedDateTime` )
LIMIT 1;
我收到错误1093 - 无法在FROM子句
中指定更新目标表我是查询写作的新手,所以建议我解决错误
谢谢
答案 0 :(得分:0)
我认为您应该使用嵌套表作为select语句中的select,如此
UPDATE tbl SET col =( SELECT ... FROM(SELECT .... FROM)AS x ); 的
答案 1 :(得分:0)
尝试以下查询:
UPDATE
LoadBal_WebAPI_RequestDetails
SET
status='vamsi'
WHERE
requestID in (select t1.requestID FROM
(select requestId, processRegistryId from LoadBal_WebAPI_RequestDetails where `status` = 'Received' order by `lastUpdatedDateTime`) t1 JOIN
`Global_AR_Processes` `ar` on `ar`.`processId` = t1.processRegistryId and `ar`.`isProcessAvailable` = 1)
LIMIT 1;