IIabm/SQL_export_high_risk_settin...

15 lines
773 B
MySQL
Raw Normal View History

2023-07-03 12:40:10 +08:00
select e_id, n_disrupt_sample, total_n_disrupt_firm_prod_experiment, dct_lst_init_disrupt_firm_prod from iiabmdb.without_exp_experiment as experiment
inner join (
select e_id, count(id) as n_disrupt_sample, sum(n_disrupt_firm_prod_sample) as total_n_disrupt_firm_prod_experiment from iiabmdb.without_exp_sample as sample
inner join (
select * from
(select s_id, COUNT(DISTINCT id_firm, id_product) as n_disrupt_firm_prod_sample from iiabmdb.without_exp_result group by s_id
) as count_disrupt_firm_prod_sample
where n_disrupt_firm_prod_sample > 1
) as disrupt_sample
on sample.id = disrupt_sample.s_id
2023-05-21 17:05:06 +08:00
group by e_id
2023-07-03 12:40:10 +08:00
) as disrupt_experiment
on experiment.id = disrupt_experiment.e_id
order by n_disrupt_sample desc, total_n_disrupt_firm_prod_experiment desc
limit 0, 95;