SELECT Section AS [@type],
COUNT(*) [@count],
(SELECT class as [@class],
studentName AS [@studentName]
FROM dbo.school sN
WHERE sN.section = s.section
FOR XML PATH('instance'),TYPE)
FROM dbo.school s
WHERE s.section = 'A'
GROUP BY s.section
FOR XML PATH('listResponse');
1条答案
按热度按时间uyhoqukh1#
一种方法是在这里使用嵌套查询。我在外部查询中筛选到
section
'A'
,然后在这里关联查询: