- 按年统计
SELECT TO_CHAR(A.SETTLE_TIME,'YYYY') TIME,COUNT(*) COUNT,SUM(A.AL_NUM)
FROM R_MEAS_BASIC_INFO A,D_STAKE_ARCH B
WHERE A.STAKE_NO=B.EQUIP_NO AND B.ORG_NO='100000302'
AND TO_CHAR(A.SETTLE_TIME,'YYYY') = TO_CHAR(SYSDATE,'YYYY')--查询本年度的
GROUP BY TO_CHAR(A.SETTLE_TIME,'YYYY') --根据年份来分组