Я хотел бы запросить одну таблицу в моей БД SQL Server, используя следующую логику:
declare @crntusrdept nvarchar(128)
set @crntusrdept = 'A'
if @crntusrdept includes ('A', 'B', 'C') then (select * from comps where dept in ('A', 'B', 'C'))
if @crntusrdept includes ('D','E') then (select * from comps where dept in ('D','E'))
if @crntusrdept includes ('F', 'G') then (select * from comps where dept in ('F', 'G'))
if @crntusrdept includes ('H') then (select * from comps where dept in ('H'))