INNER SQL 의 변환 0 1 6,172

by 손님 SQL INNER JOIN [2009.09.17 10:17:32]


안녕하세요

아래의 SQL을 오라클8i 에서 돌아갈수 있도록 INNER SQL 을 변환하고 싶습니다.

고수님의 가르침을 부탁드립니다.

 

SELECT APJ01T.NBIRAI AS No
, IIf(Left([KIJNL],3)="MP2","I/F",[NBJNL]) AS NO2

, APJ01T.NBCCT AS NO3
, APJ01T.CDSECPAY AS sect
, APJ01T.DTCOLPAY AS dday
, APJ01T.CDTORI AS CD
, Left([CDTORI],5) AS CD1

, Right(Trim([CDTORI]),3) AS CD2
, APJ01T.CDPAY AS CD3
, Left([CDPAY],5) AS CD4
, Right(Trim([CDPAY]),3) AS CD5
, APJ01T.DTJNLINPUT AS dday1
, APJ01T.CDEMPINPUT AS CD6
, Right("00000" & Left([CDEMPINPUT],3),5) AS CD7
, Right(Trim([CDEMPINPUT]),3) AS CD8
, IIf(APJ01T.KIAPR='0','A',IIf(APJ01T.KIAPR='1','B',IIf(APJ01T.KIAPR='2','C','-'))) AS accept
, APJ02T.MNSUM AS total
FROM APJ01T INNER JOIN APJ02T ON (APJ01T.NBIRAI = APJ02T.NBIRAI) AND (APJ01T.DTCOLPAY = APJ02T.DTCOLPAY) AND (APJ01T.CDSECPAY = APJ02T.CDSECPAY) AND (APJ01T.CDCO_ = APJ02T.CDCO_) AND (APJ01T.KIDEL = APJ02T.KIDEL)
GROUP BY APJ01T.NBIRAI
, IIf(Left([KIJNL],3)="MP2","I/F",[NBJNL])
, APJ01T.NBCCT
, APJ01T.CDSECPAY
, APJ01T.DTCOLPAY
, APJ01T.CDTORI
, Left([CDTORI],5)
, Right(Trim([CDTORI]),3)
, APJ01T.CDPAY
, Left([CDPAY],5)
, Right(Trim([CDPAY]),3)
, APJ01T.DTJNLINPUT
, APJ01T.CDEMPINPUT
, Right("00000" & Left([CDEMPINPUT],3),5)
, Right(Trim([CDEMPINPUT]),3)
, IIf(APJ01T.KIAPR='0','A',IIf(APJ01T.KIAPR='1','B',IIf(APJ01T.KIAPR='2','C','-')))
, APJ02T.MNSUM
, APJ01T.KIDEL
, APJ01T.CDCO_
HAVING (((APJ01T.KIDEL)="0") AND ((APJ01T.CDCO_)="01"))
ORDER BY APJ01T.NBIRAI
, IIf(Left([KIJNL],3)="MP2","I/F",[NBJNL])

 

by 마농 [2009.09.17 13:39:41]
left(컬럼, 3) ===> SUBSTR(컬럼, 1, 3)
right(컬럼, 3) ===> SUBSTR(컬럼, -3)
iif ===> DECODE
from a inner join b on 조건 ===> from a, b where 조건
댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입