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
 SQL Server Development (2000)
 SQL Query

Author  Topic 

tadhg88
Yak Posting Veteran

62 Posts

Posted - 2008-01-31 : 09:34:22
Hi,
I am having problems writing this query with SQL Server 2000, i need to display a list of players dependent on date selected but i also need to display the same list of players whether or not they have a row for that date, i have managed to write some of the SQL the relevant joins are in bold. Originally these tables will be empty for the selected date and so i need to display nulls beside the player name etc so the user can enter data but when there is data for the date selected i need to display the data. Any help would be appreciated
Thanks in advance
Tim

Select IsNull(aop.FirstName+ ' ','') + IsNull(aop.LastName,'') as 'Name',
acss.Name as 'Age',
aar.AttendanceID as 'Status',
Notes, ses.Date
From AcademyShadowSquadPlayerMapping spm
Left Join AcademyOtherPlayer aop on aop.ID = spm.PlayerID
Left Join AcademyShadowSquad acss on acss.ShadowSquadID = spm.SquadID
Left Join AcademySession ses on aar.AcademySessionID = ses.ID And ses.Date = '02/01/2008'
Left Join AcademyAttendanceRecord aar on aar.PlayerID = aop.ID

Where ((spm.SquadID = 3) or (-1 = 3))

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-31 : 23:13:10
Your query looks ok. Can you explain what your requirement is giving some sample data with table structures and expected o/p?
Go to Top of Page
   

- Advertisement -