如何在dbgrid中最后一行增加一行统计一列得和

解决方案 »

  1.   

    不用第三控件的話,就在SQL語句中實現原來的語句
    union
    統計的語句union前後的SQL語句執行的結果必須表結構一致.
      

  2.   

     select employeeid, name, cardid, 
        case stationno when '1' then '17楼小卖部' when '2' then '19楼餐厅'  end as stationno ,
        sum(consume) as con
        from consume_main where unit_id in (select left(levelid,2)  from ic_dept where name='财务部')
        and so_id in(select right(levelid,2) from ic_dept where name='财务部') 
        and dept_id in(select left(SUBSTRING(levelid, 3, 4),2)from ic_dept where name='财务部')
        and computer_id='1' and stationno>0 and curtime>'2008-12-23 12:00:00.000'
        GROUP BY employeeid,
        name,cardid, stationno
        order by employeeid
      

  3.   

    用dbgrideh 功能更强一些~~