最後の 2 つの選択クエリを 1 つのクエリに結合できますか?
DECLARE @AttributeLink table(qeaId int,nQeaId int)
insert into @AttributeLink values(100,200)
insert into @AttributeLink values(101,201)
insert into @AttributeLink values(102,202)
declare @prmVar varchar(200)
select @prmVar = COALESCE(@prmVar + ',', '') + cast(nQeaId as varchar)
from @AttributeLink
where qeaId in (100, 101)
select @prmVar