SELECT item,
decode(NO, 1, grade, '소계'),
sum(m_qty), sum(m_amt),
sum(s_qty), sum(s_amt)
FROM ( SELECT item, grade,
sum(m_qty) m_qty,
sum(m_amt) m_amt,
sum(s_qty) s_qty,
sum(s_amt) s_amt
F ROM TAB1
WHERE yymm = :in_daye
AND saup = :saup
GROUP BY item, grade
) x,
COPY_T y
WHERE y.NO <= 2
GROUP BY item, NO,
decode(NO, 1, grade, '소계') -- 소계결과값 bottom
decode(NO, 1, '소계', grade) -- 소계결과값 top
;
decode(NO, 1, grad, '소계') 로 할경우...
decode(NO, 1, '소계', grade) 로 할경우...
왜 차이점이 생기는건가요?