select 单位编号,上报日期,批次,是否转账,是否导给银行 from 表 group by 单位编号,上报日期,批次,是否转账,是否导给银行??

解决方案 »

  1.   

    大力非常高兴你在线,可是系统提示bit型不能分组阿
      

  2.   

    Select IsOutbank,A.dwbh,max(B.Dwm),A.Sbrq,A.pc,sum(A.Sbje) from Salary A left join Gzdw B on A.dwbh=B.Dwbh group by A.dwbh,A.sbrq,A.pc,Isoutbank order by A.Sbrq,A.Pc查询分析器提示
    Server: Msg 252, Level 16, State 2, Line 1
    Cannot group by a bit column.
      

  3.   

    group by cast(bit_field as tinyint)
      

  4.   

    相应的在select字段中作修改。
      

  5.   

    select 单位编号,上报日期,批次,case when 是否转账=1 then '是' else '不是' end 是否转账,case when 是否导给银行=1 then '是' else '不是' end 是否导给银行 from 表 group by 单位编号,上报日期,批次,case when 是否转账=1 then '是' else '不是' end,case when 是否导给银行=1 then '是' else '不是' end
      

  6.   

    多谢 w_rose(w_rose) 、pengdali(大力) 
    问题解决,给分