有这样一张表
name score
a 2
b 3.2
c 2.3
d 4.1需要根据score的小数位,由大到小,将score+1
且只更新 2 条记录结果即
name score
a 2
b 4.2
c 3.3
d 4.111g
请各位大虾指点
name score
a 2
b 3.2
c 2.3
d 4.1需要根据score的小数位,由大到小,将score+1
且只更新 2 条记录结果即
name score
a 2
b 4.2
c 3.3
d 4.111g
请各位大虾指点
这样取出小数点后的数字,剩下的自己来吧!
select name,
score+case when rownum<3 then 1 else 0 end new_score from(
select *
from table1
order by mod(score,1) desc
);
更新
update table1 t set score=score+1
where (select count(1) from table1 where mod(score,1)>mod(t.score,1))<2
set score = score + 1
where rowid in (select aid
from (select rowid aid, substr(a.score, 3) sc
from 表 a
where instr(a.score, '.') > 0
order by sc desc) b
where rownum <= 2)