Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Pls help me to modify the query for performance improvement

$
0
0

Hi,

I have the below initialization

DECLARE @Active bit =1 ;
Declare @id int

SELECT @Active=CASE WHEN id=@id and [Rank] ='Good' then 0 else 1 END  FROM dbo.Students

I have to change this query in such a way that the conditions id=@id and [Rank] ='Good' should go to the where condition of the query. In that case, how can i use Case statement to retrieve 1 or 0? Can you please help me to modify this initialization?



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>