15.5.12

Query in one of the forum:



using Below sample query(2 times same query with one condition as extra) to get the 2 type of result set.

IF @Status = 'A'
Select * From TableName where ID = @ID and Value > 200
Else
Select * From TableName where ID = @ID

How can i use Case statement to avoid to create the same select statement 2 times.


Here is my answer to achieve the same.





Cheers,
Venkatesan Prabu .J
Head, KaaShiv InfoTech
For free Ebook : http://kaashivinfotech.com/Ebooks.aspx 


No comments:

Post a Comment