sql去重複保留距離時間最近的一條數據

如圖:(表名叫 ExamStudentScoreInfo)
這裏寫圖片描述

sql語句:
select * from ExamStudentScoreInfo ess
where not exists(select 1 from ExamStudentScoreInfo where username = ess.username and other2 < ess.other2 and ExamId=ess.ExamId)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章