UPDATE TmpTbl SET ma5=(SELECT AVERAGE(first) FROM (SELECT TOP 5 FROM TmpTbl WHERE ID<5 ORDER BY ID DESC)) WHERE ID=5
------解决方案--------------------
- SQL code
UPDATE TmpTbl SET ma5= ( SELECT AVERAGE(first) /*AVERAGE换为AVG*/ FROM ( SELECT TOP 5 /*这里缺少列*/ FROM TmpTbl WHERE ID <5 ORDER BY ID DESC ) ) WHERE ID=5
------解决方案--------------------
UPDATE TmpTbl
SET ma5=(SELECT AVERAGE(first)
FROM (SELECT TOP 5 first FROM TmpTbl WHERE ID <5 ORDER BY ID DESC))
WHERE ID=5
------解决方案--------------------
UPDATE TmpTbl
SET ma5=(
SELECT AvG(first)
FROM (
SELECT TOP 5 first
FROM TmpTbl
WHERE ID <5
ORDER BY ID DESC)
)
WHERE ID=5