所以我做了一个简单的 SQL 查询:
SELECT companyname
FROM works w1, (
SELECT companyname,sum(salary) AS sumsal
FROM works
GROUP BY companyname
) w2
WHERE
w1.companyname=w2.companyname
到目前为止它工作正常,但后来我在 where 子句中添加了以下行:
AND w2.sumsal=(SELECT MIN(w2.sumsal)
FROM w2);
我得到:
ERROR 1146 (42S02): Table 'companydb.w2' doesn't exist
我正在使用 MySQL 8.0。