I have the following query :
The query works, well kind of works. If a person is assigned to more then one location I get the persons name multiple times. Any sugestions as to getting the personns name only once with multile locations on one line?Code:SELECT Personnel.PersonnelPK,Personnel.LastName + ', ' + Personnel.FirstName + ' ' + Personnel.MiddleName AS 'Personnel Name',WorkerTypes.CustumLevelName AS 'Worker Type',Location.Building + ' - ' + Location.LocationName As [Location] FROM Location INNER JOIN PersonnelToLocation ON Location.LocationPK = PersonnelToLocation.LocationPK RIGHT OUTER JOIN Personnel INNER JOIN WorkerTypes ON Personnel.WorkerTypePK = WorkerTypes.WorkerTypePK ON PersonnelToLocation.PersonnelPK = Personnel.PersonnelPK Where Personnel.PersonnelPK > 1 And Personnel.PersonnelPK In (Select PersonnelPK From PersonnelToLocation Where PersonnelPK = 3)
This is being returned as a dataset on .Net 2005 from and SQL Server 2005 backend.




Reply With Quote