Hi,
I've got a query that seems to take an age to execute can anyone see how I can speed it up
The execution plan indicates that the hilighted subquery is taking all the time. Does anyone know how to improve this? The problem I've got is that I need to get the record back regardless of whether the person has a role or not.Code:SELECT p.User_Id ,p.User_Name ,p.Prefix ,p.First_Name ,p.Last_Name ,IsNull(p.Prefix+' ','')+IsNull(p.First_Name+' ','')+IsNull(p.Middle_Name+' ','')+IsNull(p.Last_Name,'') As Full_Name ,IsNull(p.Prefix+' ',IsNull(p.First_Name+' ',''))+IsNull(p.Last_Name,'') As Display_Name ,p.Email ,(SELECT Min(l.Security_Level) As Sec_Level FROM LU_Roles l JOIN User_Roles u ON l.Role_ID=u.Role_ID WHERE u.User_ID=p.User_ID AND u.Status IN('A') ) As Security_Level FROM People p WHERE p.User_ID=@User_ID
Cheers Al




Reply With Quote