1. 查询表记录中时间最新的数据
用括号单独查询最新大的时间 max(create_date) 再做表关联
select t1.workday,t.schedule_id,tss.name,t.*,t1.* from t_shifts t left join t_schedules tss on t.schedule_id = tss.id, (select workday, max(create_date) create_date from t_shifts where employee_id = 59214 and workday >= to_date('2019-01-01', 'yyyy-MM-dd') and workday <= to_date('2019-12-31', 'yyyy-MM-dd') group by workday) t1 where t1.workday = t.workday and t1.create_date = t.create_date and t.employee_id = 59214 and t.schedule_id not in (681, 717) order by t.workday;