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 |
|
ddt
Starting Member
10 Posts |
Posted - 2010-05-27 : 02:28:34
|
| i have two tables Student scheduleStudentID classid ....--------- -------100 C1001100 C1002100 C1003...GradesStudentID ClassID Grade Semester...--------- ------- ----- --------100 C1001 A S1100 C1001 F S2100 C1002 D S1100 C1003 B S2...I need to join these two tables and gt results like belowResultsStudentID ClassID S1 Grade S2 Grade--------- ------- -------- --------100 C1001 A F100 C1002 D 100 C1003 B....i joined two tables with inner join on StudentID and ClassID Here's the actual query...SELECT dbo.ISB_HSStudSched.StudentID, dbo.ISB_HSStudSched.Section, dbo.GbkTermGrade.Letter, dbo.GbkTermGrade.Interval AS SemesterFROM dbo.ISB_HSStudSched INNER JOIN dbo.GbkTermGrade ON dbo.ISB_HSStudSched.StudentID = dbo.GbkTermGrade.StudentId AND dbo.ISB_HSStudSched.ClassNum = dbo.GbkTermGrade.ClassIdWHERE (dbo.GbkTermGrade.Period = '0') AND dbo.GbkTermGrade.Interval = '1' OR dbo.GbkTermGrade.Interval = '2')thanksSQL 2005 SP3 |
|
|
|
|
|