15 lines
773 B
MySQL
15 lines
773 B
MySQL
|
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
|
||
|
group by e_id
|
||
|
) 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;
|