Database

[sql] 간단한 통계 서브쿼리 예제..

by hooni posted Apr 23, 2013
?

Shortcut

PrevPrev Article

NextNext Article

ESCClose

Larger Font Smaller Font Up Down Go comment Print

서브쿼리를 이용한 초간단 통계 쿼리 예제

SELECT 
    SUM(
        DECODE(hope,1,1,0) hope1,
        DECODE(hope,2,1,0) hope2,
        DECODE(hope,3,1,0) hope3,
        DECODE(hope,4,1,0) hope4 
    )
    FROM cist_app
GROUP BY hope;