我需要将这两个查询合并为一个查询。Keyfield1 和 TPOLNO 应该是连接字段。我将如何做这个单一的查询?
SELECT TPOLNO, SUM(TTSAMT) AS SUM FROM PFPOSTR410 WHERE
((TTRNYY=2012 AND TTRNMM=3 AND TTRNDD>=27) OR (TTRNYY=2012 AND TTRNMM>3) OR
(TTRNYY=2013 AND TTRNMM<=2) OR (TTRNYY=2013 AND TTRNMM=3 AND TTRNDD<=27))
GROUP BY TPOLNO HAVING SUM(TTSAMT)>=5000 ORDER BY TPOLNO ASC
SELECT KEYFIELD1, KEYFROBJ FROM CMRELATN WHERE RELROLETC=8
提前感谢任何方向!
- 乔什