넵...다시정리해서 올립니다**
SELECT * ,(C01+C31) as TOTAL
From ( Select
(CASE AGENT_ID WHEN '' THEN Null ELSE AGENT_ID END) as X_NAME,
(CASE AGENT_ID WHEN '' THEN Null ELSE
(CASE AGENT_NM WHEN '' THEN AGENT_ID ELSE AGENT_NM END
) END
) as X_VALUE,
SUM(CASE SUBSTRING(R_S_DATE, 7, 2) WHEN '01' THEN 1 ELSE 0 END) as 'C01',
SUM(CASE SUBSTRING(R_S_DATE, 7, 2) WHEN '31' THEN 1 ELSE 0 END) as 'C31'
From TRECORD A
Where A.RFILE_NAME is not null and A.R_S_DATE <> '' and A.R_S_DATE >= '20061026'
and A.R_S_DATE <= '20061026' Group By (CASE AGENT_ID WHEN '' THEN Null ELSE AGENT_ID END), (CASE AGENT_ID WHEN '' THEN Null
ELSE (CASE AGENT_NM WHEN '' THEN AGENT_ID ELSE AGENT_NM END) END)) as Der Order By X_NAME
########에러명은 FROM keybord not found where expected