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 |
|
meberg66219
Yak Posting Veteran
65 Posts |
Posted - 2010-12-22 : 11:58:27
|
| I have 2 tables. Both have a commone field SyStudentID. I want to find out what how many IDs are in the SyStudent Table versus the AmPropsectPrevEduc table. I created a view:SELECT dbo.syStudent.SSN, dbo.syStudent.LastName, dbo.syStudent.FirstName, dbo.syStudent.SyStudentId, dbo.AmProspectPrevEduc.AmCollegeID, dbo.amPrevEduc.Code, dbo.amPrevEduc.Descrip, dbo.AmProspectPrevEduc.SyStudentID AS StudentIDFROM dbo.syStudent INNER JOIN dbo.AmProspectPrevEduc ON dbo.syStudent.SyStudentId = dbo.AmProspectPrevEduc.SyStudentID LEFT OUTER JOIN dbo.amPrevEduc ON dbo.AmProspectPrevEduc.AmPrevEducID = dbo.amPrevEduc.amPrevEducID INNER JOIN dbo.AdTerm ON dbo.amPrevEduc.UserID = dbo.AdTerm.UseridWHERE (dbo.AdTerm.Code = 'xfer')And I was trying to join the view to the SyStudent table to get the comparison.selectdbo.[MB_TransferStudent].StudentIDfromdbo.[MB_TransferStudent] left outer joindbo.SyStudent ondbo.[MB_TransferStudent].StudentID=dbo.systudent.SyStudentIDwheredbo.[MB_TansferStudent].StudentID=dbo.systudent.SyStudentIDBut the second query does not run.Any assistance would be greatly appreciated. |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-12-22 : 22:41:12
|
Is the view name is MB_TransferStudent ?How many records you are getting from view ?though may not be cause but I feel that where condition is not required.quote: selectdbo.[MB_TransferStudent].StudentIDfromdbo.[MB_TransferStudent] left outer joindbo.SyStudent ondbo.[MB_TransferStudent].StudentID=dbo.systudent.SyStudentIDwhere dbo.[MB_TansferStudent].StudentID=dbo.systudent.SyStudentID
|
 |
|
|
|
|
|