I've searched around, but haven't found the similar situation to what I'm trying to achieve. I want to execute the where clause expression only when the condition is true, otherwise I want to ignore the data that doesn't match it.
Where (
case when LeaveDateTime > FromDate and EnteringDateTime < ToDate then
(dateadd(d, Threshhold, LeaveDateTime) >= EnteringDateTime
end
);
I get Incorrect syntax near '>=' Can someone please help me solve this?