Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jim_jim
Constraint Violating Yak Guru
306 Posts |
Posted - 2011-06-16 : 09:11:23
|
| In the Below query Iam able to stuff the RptNo column into a single column but I want to use the stuffed RptNo columns and get the names for those Rptno's from a Table called RptNo_Description.QuerySELECT distinct ReqNo,count(ReqNo) NumberOfReports, Count(distinct AssignNo) numberOfAnalysts,STUFF(( SELECT ',' + convert(varchar(10)RptNo)FROM Statement_Report WHERE ReqNo= T.ReqNo FOR XML PATH('') ),1,1,'') AS RptNoFROM Statement_Report Twhere ReqNo in (select ReqNo from Request_Report where receiveddate > '1/1/2011')group by ReqNo |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2011-06-16 : 10:21:14
|
| http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
|
|
|