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 |
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2012-09-28 : 13:45:16
|
Hi All,I am having two tables T1 and T2T1 is having Student_Id and Last_Exam_DateT2 is having Student_Id and Exam_DateNow i have to update T1 table with last Exam Date. Please suggest |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-28 : 16:13:05
|
sounds like thisUPDATE t1SET t1.Last_Exam_Date = t2.MaxDateFROM T1 t1INNER JOIN (SELECT Student_Id,MAX(Exam_Date) AS MaxDate FROM T2 GROUP BY Student_id )t2ON t2.Student_Id = t1.Student_Id ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|