当前位置: 代码迷 >> Sql Server >> 这个SQL语句如何写?关于百分比的
  详细解决方案

这个SQL语句如何写?关于百分比的

热度:43   发布时间:2016-04-27 13:11:30.0
这个SQL语句怎么写?关于百分比的


ApplyAdult和ApplyEnfant占ApplyNumber(这个是总数)多少百分比

------解决方案--------------------
SQL code
select a.sceneId,    ltrim(cast(sum(b.ApplyAdult)*100./nullif(sum(AppluNumber),0) as decimal(12,2)))+'%' Adultfrom SceneInfo a join ApplyInfo b on a.sceneId = b.sceneIdgroup by a.sceneId-- ???
  相关解决方案