mysql除法运算问题 有两张表:a表两个字段:id和scoreb表三个字段:aid, total, raty现在要更新a表中id=1的score,计算公式是100*(1 - raty/total), 当然aid也要和id相同怎么写sql? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 update a inner join b on a.id=b.aidset score=100*(1 - raty/total) where a.id=1 谢谢!问题是total默认值是0,,,这个时候score更新的值应该也是0 update a inner join b on a.id=b.aid set score=100*(1 - if(total=0,0,raty/total)) where a.id=1 update a inner join b on a.id=b.aidset score=if(total=0,0,100*(1 - raty/total)) where a.id=1 存储引擎的更改 mysql建表时能用公式吗? 唯一性的问题 SQL语句转换MYSql mysql存储过程使用接收到的参数做表名的问题 请问这两种SQL写法,哪一种效率更好点。 求助c#如何连接postgreSQL数据库,帮找错误 mysql3.23升级到4.0.15a的问题 我在XP下运行mysql,为什么总是出这个错? mysql里concat和concat_ws参数问题 json数据 查询 为什么我写的这个函数看不到源代码
set score=100*(1 - raty/total) where a.id=1
谢谢!
问题是total默认值是0,,,这个时候score更新的值应该也是0
set score=100*(1 - if(total=0,0,raty/total)) where a.id=1
set score=if(total=0,0,100*(1 - raty/total))
where a.id=1