I'm trying to figure out how to filter by a date/get all options without a date ONLY WHEN @getdisabledoptions = 0, otherwise if @getdisabledoptions = 1 I want to get all of the options.
WHERE AffiliationID = @AffiliationID
AND
case
this is the case that I want to filter by disabled date or get null values if @getdisabledoptions = null
when @GetDisabledOptions = 0 then DisabledDate > GETDATE() or DisabledDate = IS NULL
otherwise here I want to just pull everything where AffiliationId = @affiliationId and not filter by date
else end
What am I doing wrong here? I've tried to look up other answers but I'm just not wording something right.