I can't figure this out.
I need to select a value if a contrition = 1 and is null if not.
So
select * from etc etc
where ......
---Here
and ZZ_vwConsCollectedDTL.CollectedWorkStationCode
case
when (@CollectedWorkStationCode = -1) then not null
else @CollectedWorkStationCode
end
So what should i do in this case?
Thanks.
so if @CollectedWorkStationCode = -1 then "and" will be and ZZ_vwConsCollectedDTL.CollectedWorkStationCode is not null
else the "and" will be and ZZ_vwConsCollectedDTL.CollectedWorkStationCode = @CollectedWorkStationCode