Results 1 to 5 of 5

Thread: [RESOLVED] Consufed on a Select Statement?

Threaded View

  1. #1

    Thread Starter
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Resolved [RESOLVED] Consufed on a Select Statement?

    I have the following query :
    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)
    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?

    This is being returned as a dataset on .Net 2005 from and SQL Server 2005 backend.
    Last edited by GaryMazzone; May 29th, 2007 at 10:16 AM. Reason: Fixing the SQL statement
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width