select p.prop_name,count(*) as populasi
from t_perusahaan t
left join t_mst_propinsi p
on t.per_prop=p.prop_id group by t.per_prop
order by populasi desc limit 6
select p.prop_name,count(*) as monev
from t_hasil_monitoring m left join t_perusahaan t
on t.per_id=m.per_id
left join t_mst_propinsi p
on t.per_prop=p.prop_id
where mon_tahun='2014'
group by t.per_prop
order by monev desc limit 6
答案 0 :(得分:0)
(select p.prop_name,count(*) as count_populasi_monev
from t_perusahaan t
left join t_mst_propinsi p
on t.per_prop=p.prop_id group by t.per_prop
limit 6
)
union
(
select p.prop_name,count(*) as count_populasi_monev
from t_hasil_monitoring m left join t_perusahaan t
on t.per_id=m.per_id
left join t_mst_propinsi p
on t.per_prop=p.prop_id
where mon_tahun='2014'
group by t.per_prop
limit 6
)