。。。什么标准?北京没有就要从陕西获取???那不能从上海获取?不能从江苏获取?
with tmp as (
select '北京' as 地区, '水' as 物料, 1 as 价格 from dual union all
select '陕西' as 地区, '水' as 物料, 2 as 价格 from dual union all
select '陕西' as 地区, '面包' as 物料, 3 as 价格 from dual union all
select '陕西' as 地区, '包子' as 物料, 5 as 价格 from dual)
select t.* from (
select
a.地区,
a.物料,
a.价格,
ROW_NUMBER () OVER (PARTITION BY 物料 ORDER BY 物料) as rn
from tmp a
) t
where t.rn=1