1
추출을 선택합니다 (doc_date에서 월) columnno, 합계 (net_amt_rm) sum_amt에 따라 순 양을 계산, 최대 (doc_date는) ddate POSM
FROM
WHERE 추출물 (doc_date에서 년) = '2010'
어떻게 달
columnno | sum amt | ddate
3 6 01/march/2010
7 250 29/july/2010 // output for union no2
7 2617 02/july/2010 // output for union no3
하지만 난 내 출력은 다음과 같이 할 것을 권장합니다 EXTRACT BY GROUP (doc_date에서 달)
UNION //union no 2
SELECT EXTRACT(month from doc_date) columnno, sum(net_amt_rm) sum_amt, max(doc_date) ddate
FROM CIM
WHERE EXTRACT(year from doc_date) = '2010'
GROUP BY EXTRACT(month from doc_date)
UNION //union no3
SELECT EXTRACT(month from doc_date) columnno, sum(net_amt_rm) sum_amt, max(doc_date) ddate
FROM CAM
WHERE EXTRACT(year from doc_date) = '2010'
GROUP BY EXTRACT(month from doc_date)
이 쿼리의 결과는 다음과 같다
columnno | sum amt | ddate
3 6 march
7 2867 july //output for union no 2 and 3 are sum together to get only one july
만