Monday, 13 May 2013

To Update Column of a table depending upon some other table’s column



UPDATE empdetails
SET location=
  (SELECT deptdetails.loc
  FROM deptdetails
  WHERE deptdetails.deptno = empdetails.deptno
  AND deptdetails.deptno   >10
  )
WHERE EXISTS
  (SELECT deptdetails.LOC
  FROM deptdetails
  WHERE deptdetails.deptno = empdetails.deptno
  AND deptdetails.deptno   >10
  );


No comments:

Post a Comment