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.
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 appreciatedThanks in advanceTimSelect IsNull(aop.FirstName+ ' ','') + IsNull(aop.LastName,'') as 'Name', acss.Name as 'Age',aar.AttendanceID as 'Status',Notes, ses.DateFrom AcademyShadowSquadPlayerMapping spmLeft Join AcademyOtherPlayer aop on aop.ID = spm.PlayerIDLeft Join AcademyShadowSquad acss on acss.ShadowSquadID = spm.SquadIDLeft Join AcademySession ses on aar.AcademySessionID = ses.ID And ses.Date = '02/01/2008'Left Join AcademyAttendanceRecord aar on aar.PlayerID = aop.IDWhere ((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? |
 |
|
|
|
|