Wednesday, September 30, 2009

SELECT된 값 바로 INSERT, UPDATE 하기

SELECT 된문 UPDATE 하기



UPDATE A
SET A.ATTEND_rsn1 = '1'
FROM LMS_ATTEND A, LMS_USER_PARTY B
WHERE A.YEAR_CD = '2008'
AND A.MONTH_CD = '2'
AND A.STUDENT_ID = B.USER_ID
AND A.PARTY_SEQ = B.PARTY_SEQ
AND B.FLAG = 'A'
AND A.STUDENT_ID IN( SELECT USER_ID

FROM LMS_USER

WHERE ACADEMY_CD = '10003'

AND DEL_YN <> 'Y' )


---------------------------------------------------------------------------



SELECT 된문 INSERT 하기



INSERT INTO EMPS( EMPNO, ENAME, SAL , DEPTNO)
SELECT EMPNO, ENAME, SAL , DEPTNO
FROM EMP
WHERE DEPTNO=10

No comments: