sql 分组查询满足条件所以数据
时间:2021-07-01 10:21:17
帮助过:2人阅读
select distinct t1.pciBillID,
2 STUFF((
SELECT distinct t2.Invoicenumber
+ ‘,‘
3 from TB_PCustomerInvoiceextend t2
4 where t1.pciBillID
= t2.pciBillID
5 FOR XML PATH(
‘‘), TYPE
6 ).value(
‘.‘,
‘NVARCHAR(MAX)‘)
7 ,
1,
0,
‘‘) data
8 from TB_PCustomerInvoiceextend t1)
AS Invoicinfo
sql 分组查询满足条件所以数据
标签: