WITH TYPE_CNT AS (
SELECT 'ALL' AS TYPE
, COUNT(1) AS CNT
FROM WEB_LOGIN
UNION ALL
SELECT CASE RESTING_TYPE WHEN '휴면' THEN 'RESTING' ELSE 'USE' END AS TYPE
, COUNT(WL.RESTING_TYPE) AS CNT
FROM WEB_LOGIN WL
GROUP BY RESTING_TYPE
UNION ALL
SELECT 'PC_ALL' AS TYPE
, COUNT(1) AS CNT
FROM CX_DEVICE_RESP
UNION ALL
SELECT CASE X_RESTING_TYPE WHEN '활성' THEN 'PC_USE' ELSE 'PC_RESTING' END AS TYPE
, COUNT(X_RESTING_TYPE) AS CNT
FROM CX_DEVICE_RESP
GROUP BY X_RESTING_TYPE
)
SELECT MIN(DECODE(TYPE, 'ALL', CNT)) AS USER_ALL
,MIN(DECODE(TYPE, 'RESTING', CNT)) AS USER_RESTING
,MIN(DECODE(TYPE, 'USE', CNT)) AS USER_USE
,MIN(DECODE(TYPE, 'PC_ALL', CNT)) AS PC_ALL
,MIN(DECODE(TYPE, 'PC_USE', CNT)) AS PC_USE
,MIN(DECODE(TYPE, 'PC_RESTING', CNT)) AS PC_RESTING
FROM TYPE_CNT
'DB > 오라클' 카테고리의 다른 글
오라클 기간내 월 더미Dummy 데이터 생성 (0) | 2017.04.10 |
---|---|
오라클 Model 예제 (0) | 2016.12.14 |
리눅스에서 ORA-01861: literal does not match format string 에러 (0) | 2016.04.01 |
[Oracle] 테스트 데이터 생성 / myBatis 구문 생성 / 멤버변수 생성 (0) | 2016.01.08 |
[Oracle] Java Bean 멤버변수 만드는 함수 (0) | 2016.01.08 |
WRITTEN BY