select name,score from student union select "总计" as name,sum(score) as score from student
sql不行吧,怎么会同时在一个query中起作用呢?我看还是找Wingsun说的控件吧.
hfyun 说的有道理不过如果要将合计行加在最后应该将select语句调换一下: select "总计" as name,sum(score) as score from student union select name,score from student group by name... 你去试试!
union
select "总计" as name,sum(score) as score from student
select "总计" as name,sum(score) as score from student
union
select name,score from student group by name...
你去试试!
它实现你的功能很方便,还在其它丰富的功能可用,一定不让你后悔!!
插入小计或合计记录,然后排序之
来一个循环把所有记录插入,并统计相应列数据,
最后把统计的值插入最后即可。或者用SQL语句也
可以。
1。hfyun的做法是用sql,用了数据库连接的方法;
2.用dbgrid增强控件,朋友们介绍的ehlib的确很好,功能强大,可就是不能脱离delphi环境,因为这是一个受限制版本的,不知哪为仁兄有full version小弟沾光?
3.ybli说的临时表方法,虽然繁琐了点我想也是不错的。
总之,谢谢大家!