sql计算出百分比

select a.level,a.Subtotal,b.total ,SUBSTRING (convert(varchar (20),(a.Subtotal*1.0/b.total*100)),1,4)+'%'as perTotal

  from ( selectlevel, COUNT(*) as Subtotal from T_UserInfo where VerSionID='V20081205002'groupbyLevel )a, ( selectCOUNT(*) as total from T_UserInfo where VerSionID='V20081205002'

 
 
posted @ 2012-01-22 16:55  duluc  阅读(336)  评论(0编辑  收藏  举报