34,590
社区成员
发帖
与我相关
我的任务
分享
print case when 1<>1 then round(100.00,2) else ceiling(200) end
print ceiling(200)
/*
200.00
200
*/
你的结果要输出成一个字段,由于前两种结果都会使这个字段是个整型的,造成第三种结果保存成整型的了。
你试试:
select case
when cust='chf001j'and nouba='chf001j' then cast(ceiling(jitu0*aprice) as numeric(10,2))
when right(cust,1)='j'and cust<>'chf001j'and nouba<>'chf001j'then cast(round(jitu0*aprice,0) as numeric(10,2))
else cast(round(jitu0*aprice,2) as numeric(10,2)) end
from xract where sorder='RR128254'