oracle select非group by的字段
可以把group by的结果集当作一个表,然后从这里表里取数就可以了。
e.g.
SELECT A.PROJECT_CODE,A.DIE_NO,E.ONE_CONSUMING FROM (SELECT T.PROJECT_CODE, T.DIE_NO, SUM(T.OFFLINE_QTY) OFFQTY
FROM DATA_PLAN T
WHERE T.BEGIN_DATE <= SYSDATE
AND T.BEGIN_DATE > SYSDATE - 10
GROUP BY T.PROJECT_CODE, T.DIE_NO) A
LEFT JOIN ERP_MPS_PROCESS E
ON A.PROJECT_CODE = E.ITEM_CODE
AND A.DIE_NO = E.DIE_NO