将 now() 替换为当前日期和自定义时间

Replacing now () with current date and custom time

我想将 now() 替换为当前日期和自定义时间,例如: 2021 年 7 月 28 日 8:00 上午

(select count(*) from students where exams.id=students.exam_id and students.exam_id=exams.id 
and end_time <> ''and bb_user_id is not null and test_status<>1 and
review_end is null and (exam_end + interval 2 day) > now() and exam_end < now()) as current

您可以使用 addtime():

设置当前日期的时间
select addtime(cast(current_date as datetime), time('08:00:00'))

注意第一个参数必须是 datetime,所以 addtime(current_date, time('08:00:00')).