SELECT SUM(DECODE(SUBSTR(address, 1, 3), '경기도', 1)) AS 경기도,
SUM(DECODE(SUBSTR(address, 1, 3), '서울시', 1)) AS 서울시,
SUM(DECODE(SUBSTR(address, 1, 3), '성남시', 1)) AS 성남시,
SUM(DECODE(SUBSTR(address, 1, 3), '안양시', 1)) AS 안양시,
SUM(DECODE(SUBSTR(address, 1, 3), '용인시', 1)) AS 용인시
FROM emp19;
SELECT COUNT(DECODE(SUBSTR(address, 1, 3), '경기도', ename)) AS 경기도,
COUNT(DECODE(SUBSTR(address, 1, 3), '서울시', ename)) AS 서울시,
COUNT(DECODE(SUBSTR(address, 1, 3), '성남시', ename)) AS 성남시,
COUNT(DECODE(SUBSTR(address, 1, 3), '안양시', ename)) AS 안양시,
COUNT(DECODE(SUBSTR(address, 1, 3), '용인시', ename)) AS 용인시
FROM emp19;