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 |
|
oziking
Starting Member
3 Posts |
Posted - 2010-08-09 : 04:26:27
|
| Total 3 tables in a database(Students, Results1, Results2)Results1 & Results 2 have more than 50000 recordsNow I want to compare ID of students (Students Table) to the Results1 and Results2 and show the records which are matching StudentID in Results1 & Results2 only. If the corresponding result of a particular field is not present in Result1 or Result2, it must print an empty value in the query resultsStudentsStudentIDFullnameResults1StudentIDFullnameR1R2Results2StudentIDFullnameR1R2I want the results asStudents.Student ID Students.Fullname Results1.R1 Results1.R2 Results2.R1 Results2.R2Thanks |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-09 : 04:47:40
|
Homework question? N 56°04'39.26"E 12°55'05.63" |
 |
|
|
oziking
Starting Member
3 Posts |
Posted - 2010-08-09 : 05:08:10
|
| no not at allits been ages since i left schooljust trying to make my life easier in admissions |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-09 : 05:15:20
|
[code]SELECT s.StudentID, s.FullName, r1.FullName, r1.R1, r1.R2, r2.R1, r2.R2FROM dbo.Students AS sLEFT JOIN dbo.Results1 AS r1 ON r1.StudentID = s.StudentIDLEFT JOIN dbo.Results2 AS r2 ON r2.StudentID = s.StudentID[/code] N 56°04'39.26"E 12°55'05.63" |
 |
|
|
oziking
Starting Member
3 Posts |
Posted - 2010-08-09 : 06:28:04
|
| thanks a lot :) |
 |
|
|
slimt_slimt
Aged Yak Warrior
746 Posts |
Posted - 2010-08-14 : 04:04:06
|
| (ROFL) this post just made my day :) |
 |
|
|
|
|
|