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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Group User Assignments

Author  Topic 

Zath
Constraint Violating Yak Guru

298 Posts

Posted - 2007-01-10 : 15:55:02
I have a working query and all the info is coming back just fine.

But I need to make an adjustment and can't seem to find anywhere on how to accomplish this.

The query below retrieves information about each user - userName
Each user has MANY assignments - WRNumber

As the query stands, it gets a LOT of rows.

I need to consolidate WRNumber.
That is, the user only shows up ONCE, only one row and on that row, in WRNumber, would be about 5 - 10 WRNumbers.

Can this be done in the same select or I need to use another stored procedure?

SELECT a.ID,
a.AssigneeID,
(d.WRFormCode + CAST(a.ID as CHAR)) AS 'WRNumber',
(b.FirstName + ' ' + b.LastName) AS 'userName'

FROM tblProjectAssignees a,
tblUsers b,
tblWorkRequests c,
tblRefRequestFormSelect d

WHERE a.WorkRequestID = c.ID
AND c.RequestFor = 'Validation Lab'
AND (c.Status = 'In-Progress' OR c.Status = 'In-Planning')
AND d.WRFormName = 'Validation Lab'


Thanks for any suggestions,

Zath

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-01-10 : 16:45:23
I think you could use a GROUP BY, but it's hard to know with the information that you've given. Please show us a few rows that your current query is returning as well as what the expected result set should look like.

Tara Kizer
Go to Top of Page
   

- Advertisement -