View Single Post

   
  #1 (permalink)  
Old 02-29-2008, 04:54 AM
kieran
 
Posts: n/a
Default SQL Join Statement problem

Hi,

I have the following SQL statement which is pulling a few details from
a database. As you can see, there is only the one table from which i
am creating a temporary copy.
The reason I do this is because in the table i only have the 'standIn'
listed by integer and i want to return the 'standIn' by name.

I hope this is clear enough.

The statement works but i am now noticing that it lists multiple
returns in SQL Analyser e.g it is listing three different rows for one
user and these have all been past StandIns for the user in question.
It is not a problem at the moment but it may be and i would like to
know why it is doing this. Can i change the statement to stop this, i
have been messing with the join part but no luck.

Any help greatly appreciated.

-----------------------------------------------------


SELECT T2.FirstName AS StandIn_FirstName, T2.LastName AS
StandIn_LastName
FROM tblStaff AS T1
LEFT OUTER JOIN tblStaff AS T2
ON T1.StaffNo = T2.StandIn
WHERE (T1.NTUserName = 'auser')
Reply With Quote