SQL根据十进制格式过滤输出

时间:2013-09-24 07:05:43

标签: sql sql-server sql-server-2008

我正在使用SQL Server 2008,我有这样的输出:

OrderNo        Amount1       Amount2       Amount3      Amount4 
----------------------------------------------------------------
20001        473.050000     24.080000    528.050000    63.040000
20002        473.052854     24.081236    528.054536    63.044256
20003        563.960000     35.220000    679.050000    95.780000
20004        563.963566     35.223569    679.052122    95.784569
20005        897.050000     96.960000    346.120000    33.940000
20006        897.052365     96.964568    346.121897    33.944544
20007        268.550000     19.660000    986.330000    81.550000
20007        268.551778     19.663655    986.333566    81.553365  

如何过滤输出并删除十进制格式的数字,如“123.456789”,其余的将是“123.450000”,如下所示:

OrderNo        Amount1       Amount2       Amount3      Amount4 
----------------------------------------------------------------
20001        473.050000     24.080000    528.050000    63.040000
20003        563.960000     35.220000    679.050000    95.780000
20005        897.050000     96.960000    346.120000    33.940000
20007        268.550000     19.660000    986.330000    81.550000

谢谢,

1 个答案:

答案 0 :(得分:1)

如果您想检查一个数字是否有两个以上的非零数字,那么:

WHERE ROUND(Amount1,2) = Amount1

相应地将其用于其他领域。