【发布时间】:2011-02-04 16:23:15
【问题描述】:
我有以下查询,我正在尝试用总金额更新 table1。 有没有办法在 1 步中做到这一点?
select e.id
, p.id
, case
when count(distinct e.item) = 1 then 100
when count(distinct e.item) = 2 then 150
when count(distinct e.item) = 3 then 200
when count(distinct e.item) = 4 then 225
when count(distinct e.item) = 5 then 275
when count(distinct e.item) = 6 then 325
when count(distinct e.item) = 7 then 375
when count(distinct e.item) = 8 then 450
when count(distinct e.item) = 8 then 470
end as TotalPay
from table1 p
join table2 e on e.id = '111111'
and p.id=e.itemid
group by e.id, p.id
【问题讨论】:
标签: sql oracle oracle10g sql-update