SQL查询百分比 - SQL 0.36 KB
                                
                                    /****** Script for SelectTopNRows command from SSMS  ******/
SELECT sum(a.fr_wc )as wc ,SUM(a.fr_ys)as ys, round(sum(a.fr_wc )/SUM(a.fr_ys),2)* 100 - 100 as b FROM(
SELECT [yuefen]
      ,[bumen]
      ,[bumenid]
      ,[fr_wc]
      ,[fr_ys]
      ,[fr_bfb]
  FROM [new_jxkh].[dbo].[Vsr_yxh_bm_fr]
  where  YEAR(yuefen) = 2019 AND MONTH(yuefen) = 1) a
                                
                            

代码段托管 By 爱程序代码段托管