请教:比较小数后2位大小 有个float字段里面有一些数据70.1478.0279.09.....怎么只把小数点后2位的大小比较出来 比如说大于0.12的象上面的比较的话就只有 70.14满足这个条件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 declare @n table( a float) insert into @n values(70.14)insert into @n values(78.02)insert into @n values(79.09)declare @i floatset @i = 0.12select * from @nwhere right(round(a,2),2) > right(@i,2)结果:70.14 declare @t table(num float)insert @t select 70.14 insert @t select 78.02 insert @t select 79.09 insert @t select 10select * from @t where cast('0'+rtrim(right(num,len(num)-charindex('.',num)+1))as float)>0.12 and charindex('.',num)>0/*num ----------------------------------------------------- 70.140000000000001*/ 借用楼上测试数据:declare @t table(num float)insert @t select 70.14 insert @t select 78.02 insert @t select 79.09 insert @t select 10select * from @t where num-cast(num as int)>0.12 借用楼上测试数据:declare @t table(num float)insert @t select 70.14 insert @t select 78.02 insert @t select 79.09 insert @t select 10select * from @t where num-cast(num as int)>0.12 求一sql语句 数据库参数高难度问题. 另一类数据汇总,有兴趣的进来做做,小弟在此谢谢了(50分) sql随机函数rand,求一条语句 如何提高SQL速度? 数据存储方式 急死了请高手帮帮忙 db2新建用户的初始密码是什么啊? 如何从一数据库中查找出含有某一字段名的所有表名?并从这些表中判断该字段是否已有某一值? 打不开企业管理器了??帮忙研究研究 想写一通用的存储过程分页 这个表格的SQL语句应该如何写?
(
a float
)
insert into @n values(70.14)
insert into @n values(78.02)
insert into @n values(79.09)declare @i float
set @i = 0.12
select * from @n
where right(round(a,2),2) > right(@i,2)结果:
70.14
insert @t select 70.14
insert @t select 78.02
insert @t select 79.09
insert @t select 10
select * from @t where cast('0'+rtrim(right(num,len(num)-charindex('.',num)+1))as float)>0.12 and charindex('.',num)>0
/*num
-----------------------------------------------------
70.140000000000001
*/
借用楼上测试数据:
declare @t table(num float)
insert @t select 70.14
insert @t select 78.02
insert @t select 79.09
insert @t select 10
select * from @t where num-cast(num as int)>0.12
借用楼上测试数据:
declare @t table(num float)
insert @t select 70.14
insert @t select 78.02
insert @t select 79.09
insert @t select 10
select * from @t where num-cast(num as int)>0.12