This is my query which is not compiling:
Select 1 from dbo.EmailAddresses e
Inner Join Users u On e.UserID = u.UserID
Where LOWER(EmailAddress) = @EmailAddress
And
Case When @For = 1 Then e.JurisdictionID IS NOT NULL When @For = 2 Then e.AccountID IS NOT NULL End
Can anybody tell me a way to write this query without dynamic query i.e building a query in string?
This should work: