Quote:
AND i.here IN ('Y', @activeInd)
If I understand your question correctly you will need to replace 'Y' with your case statement.
Also your case statement is comparing a < and > with a string and not a number. Not sure exactly why or what you are trying to do here.