select
distinct
uid,
'activity1' activity
from
exam_record
where
score is not null
and uid not in (
select uid
from exam_record
where score<85
)
union all
select
distinct
uid,
'activity2' activity
from
exam_record a,
examination_info b
where a.exam_id=b.exam_id
and b.difficulty='hard'
and a.score>80
and TIMESTAMPDIFF(SECOND,start_time,submit_time)<=(b.duration/2*60)
order by uid

京公网安备 11010502036488号