1. 程式人生 > >sql語句逗號分隔查詢結構

sql語句逗號分隔查詢結構

select  ROW_NUMBER() OVER(ORDER BY dd.manno) number,jj.cdesc,dd.manno,ee.itnbrf as itnbr,ff.itdsc ,dd.prqty ,[prosspath]=stuff((select ','+bb.prossname 
 from MS.dbo.manpropd  aa inner join borprc  bb on
aa.prosscode=bb.prosscode  where aa.manno=dd.manno order by aa.seq  for xml path('')), 1, 1, '') ,

  CONVERT(varchar(100), dd.prdate, 23) prdate ,hh.statusname,dd.keyinname,CONVERT(varchar(100), dd.keyindate, 23) as keyindate,dd.hmark as mark,dd.haveprice
 from  MS.dbo.manproph  dd
 inner join manmas  ee on  dd.manno=ee.manno
 left join invmas ff on ee.itnbrf=ff.itnbr
 left join miscode jj on jj.code =ee.cusno and jj.ckind ='CA'
 left join MS.dbo.monpurstatus hh on hh.statusid=dd.prstatus
 where 1=1 {0} order by number