test3.txt
885 Bytes
select count(*) from bsth_c_s_sp_rule_rst
show index from bsth_c_s_sp_rule_rst
select * from bsth_c_s_sp_rule_rst t
where not exists (select 1 from bsth_c_s_sp_rule_rst
where create_date > t.create_date and schedule_date < '2017-04-17' )
and t.xl_id = 10407 and t.schedule_date < '2017-04-17'
show index from bsth_c_s_sp_rule_rst
select * from bsth_c_s_sp_rule_rst
where xl_id = 1
select * from bsth_c_s_sp_rule_rst t
where t.xl_id = 10407 and t.schedule_date < '2017-04-17'
select count(distinct concat(xl_id ,schedule_date, create_date)) / count(*) from bsth_c_s_sp_rule_rst
select * from bsth_c_s_sp_rule_rst a
where exists (select 1 from
(select t.rule_id as rid, max(t.schedule_date) as sd from bsth_c_s_sp_rule_rst t
where t.xl_id = 10407 and t.schedule_date < '2017-04-17'
group by t.rule_id) a2 where a.rule_id = rid and a.schedule_date = sd)