mesa/SQL_analysis_risk.sql

12 lines
390 B
MySQL
Raw Normal View History

2024-08-24 11:20:13 +08:00
select * from
(select s_id, id_firm, id_product, min(ts) as ts from iiabmdb.without_exp_result
where `status` = 'D'
group by s_id, id_firm, id_product) as s_disrupt
where s_id in
(select s_id from
(select s_id, id_firm, id_product, min(ts) as ts from iiabmdb.without_exp_result
where `status` = 'D'
group by s_id, id_firm, id_product) as t
group by s_id
having count(*) > 1)
order by s_id;