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