General information
Forum:
Microsoft SQL Server
Title:
Tune up the update statement
this update statement takes 10 to 20 seconds to run. anyway to tune up the statement?
update ea
set ea.Next_Activity_Date_New = rn.date_
from employee_accounts ea
inner join (select min(appt_date) as date_,company from rn_appointments
where appt_date > convert(varchar(20), getdate(),1) and (activity_complete is null or activity_complete = 0)
group by company) as rn
on rn.company = ea.company_id
where (ea.delete_flag is null or ea.delete_flag = 0) and ea.employee_id = @employee_id
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only