SELECT A,B,COUNT(*)

FROM (

SELECT 

1 AS A,

2 AS B

FROM DUAL

UNION ALL

SELECT 

1 AS A,

2 AS B

FROM DUAL

UNION ALL

SELECT

1 AS A,

3 AS B

FROM DUAL

)

GROUP BY ROLLUP(A,B)




이걸 한번 돌려보면 이해가 잘된다..

Posted by 삽지리
,