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;