你好我有这个查询:
SELECT DISTINCT a.id, a.runcd,
(SELECT SUM(b.CALVAL) FROM GRS b
WHERE b.PCode=11000
AND a.id = b.id
AND a.runcd=b.runcd) AS qval
FROM GRS a
WHERE a.crt = k04
这是一样的吗:
SELECT a.id, a.runcd,
(SELECT SUM(b.CALVAL) FROM GRS b
WHERE b.PCode=11000
AND a.id = b.id
AND a.runcd=b.runcd) AS qval
FROM GRS a
WHERE a.crt = k04
GROUP BY id,runcd
到目前为止,这会返回相同的结果,但我不知道这是否是正确的选择。谢谢你!