e******r 发帖数: 220 | 1 I used the following command to format the data output, but got some
wired data. What is the reason? Thanks
select round( ( ( bestbid + bestoffer) /2 ) / 0.05 , 0 ) * 0.05
as mbbo from table;
mbbo
34.200000000000003
14.25
6.2000000000000002
45.650000000000006
10.15
1.1500000000000001
4.5499999999999998
0.70000000000000007
3.4000000000000004
13.25
6.0
12.0
5.0500000000000007
1.4000000000000001
28.25
0.65000000000000002
20.950000000000003
0.30000000000000004
2.8000000000000003
0.700000 |
a*******t 发帖数: 891 | 2 don't know
but if you want to format data, use cast |
e******r 发帖数: 220 | 3 你说的 CAST 就是指 CONVERT FUNCTION 吧?
【在 a*******t 的大作中提到】 : don't know : but if you want to format data, use cast
|
a*******t 发帖数: 891 | 4 cast and convert are basically the same
either one is fine
【在 e******r 的大作中提到】 : 你说的 CAST 就是指 CONVERT FUNCTION 吧?
|
c*******e 发帖数: 8624 | 5 round off error? I guess it's introduced by the 0.05
try it without 0.05; if not then use cast
【在 e******r 的大作中提到】 : 你说的 CAST 就是指 CONVERT FUNCTION 吧?
|