0
我現在有一個類似的查詢到這一個..SQL多個結果不同的值
select i.App_Id as ApplicationId,
Cast(i.ObjectId as NVARCHAR(50)) as ObjectId,
1 as ActivityId,
Cast(case
when oh.ObjectId is null then 0
else 1
end as BIT) as Highlight,
iu.UserId as UserId
from table0 i
inner join table1 iu
on i.IdeaID = iu.IdeaID
left join table2 oh
on oh.ObjectId = i.IdeaID
left join table3 mIS
on i.IdeaID = mIS.IdeaID
AND mIS.EndTime is null
inner join table4 mISF
on mISF.StateFluxId = mIS.StateFluxId
where (iu.RelationId = 1 or iu.RelationId = 2)
這是返回,例如:
2 | 1 | 1 | 1 | 1
2 | 1 | 1 | 1 | 2
2 | 1 | 1 | 1 | 3
我m試圖改變它以合併第五列的結果,當其他列值相同時:
2 | 1 | 1 | 1 | 1,2,3
這是pos錫布爾赫丁?沒有設法使用Stuff功能來完成它。
謝謝!
什麼是T1必要的改變? iu我猜 – Serg
很抱歉編輯它的別名@Serg – mohan111