我的表有一个保留6位有效数字的列
units
1.000000
1.110000
3123.111111
2.000911
1.223000
3123.000000想得到小数位大于2位的数据期望结果
units
3123.111111
2.000911
1.223000
units
1.000000
1.110000
3123.111111
2.000911
1.223000
3123.000000想得到小数位大于2位的数据期望结果
units
3123.111111
2.000911
1.223000
from YourTable
where Units <> INT(Units )
insert @t select
2.000000 union select
1.222000 union select
1.200000 union select
3123.231 select *
from @t
where units <> round(units,1)
/*
Units
--------------
1.222000
3123.231000(所影响的行数为 2 行)*/
insert into tb values(1.000000)
insert into tb values(1.110000)
insert into tb values(3123.111111)
insert into tb values(2.000911)
insert into tb values(1.223000)
insert into tb values(3123.000000)
goselect * from tb where (units * 100) - floor(units * 100) > 0drop table tb/*
units
--------------------
3123.111111
2.000911
1.223000(所影响的行数为 3 行)*/