Advertisement
yuvarajupadhyaya

Cross Join

May 23rd, 2022
494
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT tt.StudentId, tt.ChangedTime, tt.SubjectId
  2. FROM StudentResults_Log tt
  3. INNER JOIN
  4.     (SELECT StudentId, MAX(ChangedTime) AS MaxDateTime
  5.     FROM StudentResults_Log
  6.     GROUP BY StudentId) groupedtt
  7. ON tt.StudentId = groupedtt.StudentId
  8. AND tt.ChangedTime = groupedtt.MaxDateTime
Advertisement
RAW Paste Data Copied
Advertisement