I have the following code that lists certain business agreements. You have the Yes or No option.
DECLARE @Opcao VARCHAR(7)
SET @Opcao = 'S'
SELECT * FROM
BLA BLA BLA
WHERE
((('{Opcao}' = 'S') AND NFDataEmis BETWEEN lme.LogMovEstqDataHora AND ppme.ParcPagMovEstqDataVenc) or ('{Opcao}' = 'N'))
AND ec.CategCodEstr like '{Categoria}' + '%'
AND crd.ClasseRecDespCodEstr like '{Acordo}' +'%'
AND me.MovEstqDataMovimento BETWEEN @Data_inicial AND @Data_final
What happens is that it brings me all the options that are listed S and N. I wanted to make a CASE to bring the options that are not in S and N. How could I do that?
SQL SERVER USE