|
-
UPDATE query with JOIN
Suppose I am having following 2 tables
Emp_det
Name Grade Sal
ABC A
PQR B
XYZ C
and
Grade_det
Grade Sal
A 1000
B 2000
C 3000
Now I want to update salary of employee having grade A.
Simplest way is
update emp_det e
set sal =
(
select g.sal from grade_det g
where e.grade = g.grade
and g.grade = 'A'
)
where exists
(
select g.sal from grade_det g
where e.grade = g.grade
and g.grade = 'A'
);
But using "where exists" is very slow if my tables contains high volume of data.
Is there any other way to do the same with fast execution?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|