Wednesday 29 June 2011

In EMP table, for those emp whose Hiredate is same, update their sal by "sal+500" or else for others keep the sal as it is, how to do it by SQL query


UPDATE emp
SET sal=sal+500
WHERE hiredate IN (SELECT hiredate
                                            FROM employees
                                             HAVING COUNT(*)>1
                            GROUP BY hiredate)

No comments:

Post a Comment