vendredi 8 septembre 2017

Use if in sql-server

I have a small query in my stored procedure:

(case when t.status =4 and (select top 1 nd.status from tableND nd where nd.Code= t.Code order by nd.ID desc)=4 then 6 else t.status end) as status from tableTC t

The problem is the speed performance too slow. So, I wanna change it into another query. What should i do now ?

Aucun commentaire:

Enregistrer un commentaire