IIabm/SQL_analysis_risk.sql

12 lines
390 B
MySQL
Raw Permalink Normal View History

2023-07-09 15:38:49 +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;