DB는 파라독스이고, 나름대로 열심히 머리굴려서 생각했는데
안됩니다..
원래는 아래의 쿼리를 사용했는데..
----------------------------------------------------------
SELECT M.MST_ACTNO AS ACTNO
, (SELECT SUM(TT.TRANS_IPGUM)
FROM TRANS.DB AS TT
WHERE M.MST_ACTNO = TT.TRANS_ACTNO) AS TOT_IPGUM
, (SELECT SUM(TT.TRANS_CHULGUM)
FROM TRANS.DB AS TT
WHERE M.MST_ACTNO = TT.TRANS_ACTNO) AS TOT_CHULGUM
FROM CUSTOM.DB AS C, TRANS.DB AS T, MASTER.DB AS M
WHERE CUST_CODE = MST_CSCODE
AND CUST_CODE = TRANS_CSCODE
AND MST_ACTNO = TRANS_ACTNO
GROUP BY M.MST_ACTNO
-------------------------------------------------------------
위 같이 하면, 넘 시간이 많이 걸려서요 아래와 같이 고쳤습니다..
------------------------------------------------------------
SELECT M.MST_ACTNO AS ACTNO
T.TOT_IPGUM AS TOT_IPGUM
T.TOT_CHULGUM AS TOT_CHULGUM
FROM CUSTOM.DB AS C, MASTER.DB AS M
, (SELECT SUM(TT.TRANS_IPGUM) AS TOT_IPGUM
, SUM(TT.TRANS_CHULGUM) AS TOT_CHULGUM
FROM MASTER.DB AS MM, TRANS.DB AS TT
WHERE MM.MST_ACTNO = TT.TRANS_ACTNO
GROUP BY MM.MST_ACTNO) AS T
WHERE C.CUST_CODE = M.MST_CSCODE
AND M.MST_ACTNO = T.TRANS_ACTNO
GROUP BY M.MST_ACTNO
--------------------------------------------------------------
제 생각에는 될것 같은데.. tot_ipgum에서 Invalid use of keyword.에러가
발생합니다..
도와주세요.....
> DB는 파라독스이고, 나름대로 열심히 머리굴려서 생각했는데
> 안됩니다..
> 원래는 아래의 쿼리를 사용했는데..
> ----------------------------------------------------------
> SELECT M.MST_ACTNO AS ACTNO
> , (SELECT SUM(TT.TRANS_IPGUM)
> FROM TRANS.DB AS TT
> WHERE M.MST_ACTNO = TT.TRANS_ACTNO) AS TOT_IPGUM
> , (SELECT SUM(TT.TRANS_CHULGUM)
> FROM TRANS.DB AS TT
> WHERE M.MST_ACTNO = TT.TRANS_ACTNO) AS TOT_CHULGUM
> FROM CUSTOM.DB AS C, TRANS.DB AS T, MASTER.DB AS M
> WHERE CUST_CODE = MST_CSCODE
> AND CUST_CODE = TRANS_CSCODE
> AND MST_ACTNO = TRANS_ACTNO
> GROUP BY M.MST_ACTNO
> -------------------------------------------------------------
> 위 같이 하면, 넘 시간이 많이 걸려서요 아래와 같이 고쳤습니다..
>
> ------------------------------------------------------------
> SELECT M.MST_ACTNO AS ACTNO
> T.TOT_IPGUM AS TOT_IPGUM
> T.TOT_CHULGUM AS TOT_CHULGUM
> FROM CUSTOM.DB AS C, MASTER.DB AS M
> , (SELECT SUM(TT.TRANS_IPGUM) AS TOT_IPGUM
> , SUM(TT.TRANS_CHULGUM) AS TOT_CHULGUM
> FROM MASTER.DB AS MM, TRANS.DB AS TT
> WHERE MM.MST_ACTNO = TT.TRANS_ACTNO
> GROUP BY MM.MST_ACTNO) AS T
> WHERE C.CUST_CODE = M.MST_CSCODE
> AND M.MST_ACTNO = T.TRANS_ACTNO
> GROUP BY M.MST_ACTNO
> --------------------------------------------------------------
> 제 생각에는 될것 같은데.. tot_ipgum에서 Invalid use of keyword.에러가
> 발생합니다..
>
> 도와주세요.....
파라독스에서 from 절에서의 inlineview는 지원되지 않습니다.