为什么么折扣率总是为0 我有一个以下的一个表table1,但用select 名称,实际价/标价 折扣率 from table1,得到的折扣率都为0,怎么回事?名称 标价 实际价aaa 300 270bbb 500 450ddd 600 550www 300 250 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 declare @tb table (名称 varchar(20),标价 int,实际价 int)insert into @tb select 'aaa',300,270insert into @tb select 'bbb',500,450insert into @tb select 'ddd',600,550insert into @tb select 'www',300,250select 名称,ltrim(cast(实际价*100.0/标价 as decimal(10,2)))+'%' as 折扣率 from @tb名称 折扣率aaa 90.00%bbb 90.00%ddd 91.67%www 83.33% 【求助】一段创建View视图的sql语句,请问怎样改正?求大神! 为什么在SQLServer中的查询分析器中使用Round函数失效? SQL SERVER中如何删除记录 请大侠帮我简化一下代码 多个字段只有其中的一个字段触发DB_E_ERRORSOCCURRED异常是怎么回事??? 数据类型的表示 求教如何定期仅备份数据库的结构 求救:简单SQL查询 存储过程中:前缀数目超过了最大值。最大值为 3的问题,让我想了一天多没见成功? 如何在恢复数据库之前切断其他用户和数据库的连接 请教ASP写入数据库的问题. 错误求助:将数据类型 varchar 转换为 float 时出错。
insert into @tb select 'aaa',300,270
insert into @tb select 'bbb',500,450
insert into @tb select 'ddd',600,550
insert into @tb select 'www',300,250select 名称,ltrim(cast(实际价*100.0/标价 as decimal(10,2)))+'%' as 折扣率 from @tb
名称 折扣率
aaa 90.00%
bbb 90.00%
ddd 91.67%
www 83.33%