I am trying to put CASE Statement in Where clause, but I am getting error: Incorrect syntax near ‘>’.
WHERE
ItemCategoryID=@CategoryID
AND AuctionStatus=1
AND SE_UsersMain.isActive=1
AND AuctionOwner!=@OwnerID
AND
CASE
WHEN @CompareSign=1 THEN @CurrentAmount>@FilterAmount
WHEN @CompareSign=2 THEN @CurrentAmount<@FilterAmount
WHEN @CompareSign=3 THEN @CurrentAmount=@FilterAmount
END
Try this: