是否可以从SQL中的级联删除输出值?
类似的东西:
DELETE [Families]
OUTPUT [deleted].[FamilyID] [deleted].[FamilyName], [Members].[MemberName]
FROM [Families]
LEFT JOIN [Members]
ON [Members].[FamilyID] = [Families].[FamilyID]
如果有两个家庭有三个总成员,它应该产生类似的东西:
[FamilyID] [FamilyName] [MemberName]
12 'Family A' 'Member 1'
12 'Family A' 'Member 2'
13 'Family B' 'Member 3'
对于解决方案,每个系列产生1行,并且在分隔列表中使用级联删除的成员也是可以接受的。类似的东西:
[FamilyID] [FamilyName] [MemberNames]
12 'Family A' 'Member 1|Member 2'
13 'Family B' 'Member 3'
答案 0 :(得分:2)
我能找到的最佳解决方案产生两个结果集: