查询订单日志表截至2021年8月最后生效的一条日志记录
select order_no,max(id) max_id from orders_log where time<'2021-08-01' group by order_no;
拉取所有记录
SELECT * from orders_log where id in(
select max(id) max_id from orders_log where time<'2021-08-01' group by order_no
);