T_MaintainRecord 表名
MR_Money   维修费用
MR_Department  部门名称我是想查的是  一个部门的维修费用总和.SQL语句是什么

解决方案 »

  1.   

    select sum(MR_Money) from T_MaintainRecord group by MR_Department
      

  2.   

    select sum(MR_Money),MR_Department from T_MaintainRecord 
    group by MR_Department
      

  3.   

    select MR_Department,sum(MR_Money) from T_MaintainRecord group by MR_Department
      

  4.   

    加个时间.按时间查询费用总和.MR_ReturnDate时间.
      

  5.   

    select MR_Department,sum(MR_Money) from T_MaintainRecord group by MR_Department
      

  6.   

    分组查询只能有一个条件,按时间或按部门查询
    select MR_Department,sum(MR_Money) from T_MaintainRecord group by MR_Department
    or
    select MR_ReturnDate,sum(MR_Money) from T_MaintainRecord group by MR_ReturnDate
      

  7.   

    select MR_Department,sum(MR_Money),MR_ReturnDate from T_MaintainRecord where MR_ReturnDate > 时间起 and MR_ReturnDate < 时间止 group by MR_Department,MR_ReturnDate