根據分組數據所佔比例,取對應比例的數據
select rank() over(partition by a.province order by dbms_random.value) ll,
a.lng,
a.lat,
c.ee
from crm_gd_lnglat a
left join (select province, round(5000 * temp / total) ee
from (select province, count(*) temp
from crm_gd_lnglat
where lng is not null
group by province) a,
(select count(*) total
from crm_gd_lnglat
where lng is not null) b) c on a.province =
c.province
where a.lng is not null
a.lng,
a.lat,
c.ee
from crm_gd_lnglat a
left join (select province, round(5000 * temp / total) ee
from (select province, count(*) temp
from crm_gd_lnglat
where lng is not null
group by province) a,
(select count(*) total
from crm_gd_lnglat
where lng is not null) b) c on a.province =
c.province
where a.lng is not null
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.