Click here to Skip to main content
15,900,258 members

Comments by ravitv (Top 29 by date)

ravitv 23-Aug-22 9:14am View    
Sorry OriginalGriff.....
I did a big mistake in Student Table Data, this gave the incorrect count or rows even when I add the line for checking 'Discontinued' Status....

Here is the code that works
CASE(@Status)
WHEN 1 THEN 'PASS'
WHEN 2 THEN 'FAIL'
ELSE 'DISCONTINUED'
END AS Status FROM StudentMst

WHERE ((@SID IS NULL)OR SID = @SID).... bla bla bla
Sorry for the troulble and thanks for suggesting to "read" CASE WHEN again,
as well as thanks again for spending your precious time to help me out of the problem.
Thanks
Ravi.
ravitv 23-Aug-22 7:38am View    
Sorry OriginalGriff, I dont have one,
All I have is this one

SELECT SId,SName,Std,Status,
CASE
WHEN (
((Status = '1')
)
THEN 'PASS'
ELSE 'FAIL'
END AS Status FROM StudentMst
WHERE ((@SID IS NULL)OR SID = @SID).... bla bla bla

I dont know how to do the changes to validate "Discontinued" status, WHEN Status=3 in the above SQL.
Kindly help,
Thanks
Ravi
ravitv 21-Aug-22 4:18am View    
Hi OriginalGriff,
here is another situation to include "Discontinued" when status=3.
How can I write the SQL please.
Thanks
Ravi
ravitv 21-Aug-22 3:59am View    
Oh...I figured it out OriginalGriff, thanks..
I forgot to include all the column names.
Excellent OriginalGriff,
thanks again.
Ravi
ravitv 21-Aug-22 3:39am View    
Thanks OriginalGriff,
but where can I use this
CASE WHEN Std = @GradeYouWantToMatch.........
in the Stored Procedure. I have no idea.
Can you please give me a clue