select * from A where StudentId in ( SELECT StudentId FROM A WHERE CheckTime > '2020-12-22' AND CheckState = 'extractfail' GROUP BY StudentId,Author,Title HAVING COUNT(0) > 1) and CheckId not in ( select min(convert(varchar(40), CheckId)) from A WHERE CheckTime > '2020-12-22' AND CheckState = 'extractfail' group by StudentId,Author,Title HAVING COUNT(0) > 1 ) and CheckTime > '2020-12-22' AND CheckState = 'extractfail'
#注意这里的
min(convert(varchar(40), CheckId)) 需要类型转换后才可用min 直接 min(CheckId) 会提示类型uuid 不支持min 函数