DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: qiaoguoqiang
今日帖子: 0
在线用户: 1
导航: 论坛 -> 数据库专区 斑竹:liumazi,waterstone  
作者:
男 freewyl (freewyl) ★☆☆☆☆ -
盒子活跃会员
2004/3/7 15:23:13
标题:
如何统计交叉以后的表的行和列的计算? 浏览:1347
加入我的收藏
楼主: 如何统计交叉以后的表的行和列的计算,下面附件里是我对表进行叉以后的:

我想对其进行,行、列的统计却不知道怎么做,才能得如下结果:

姓名   数学   英语   语文    不及格科
李四   30     85     80       1科
王五   45     50     5作      3科
张三   8缺    100    60       1科
合计   3人    1人    1人      5人
此帖子包含附件:
GIF 图像
大小:18.7K
----------------------------------------------
读好书可以净化心灵,交挚友能够升华人生。山外有山,能人背后自有更强能人在!
作者:
男 freewyl (freewyl) ★☆☆☆☆ -
盒子活跃会员
2004/3/8 14:09:20
1楼: 救命啊!!!!!!!!!!各位来帮帮忙啊!
----------------------------------------------
读好书可以净化心灵,交挚友能够升华人生。山外有山,能人背后自有更强能人在!
作者:
男 zsredmoon (=^@^=) ★☆☆☆☆ -
盒子活跃会员
2004/3/8 16:04:06
2楼: select a.name as name
, (select source from test where name = a.name and subject = 'k1') as 语文
, (select source from test where name = a.name and subject = 'k2') as 数学
, (select source from test where name = a.name and subject = 'k3') as 英语
, (select count(source) from test where name = a.name and source<60) as 不及格
from test a
group by a.name
union
select ' as name
, (select count(source) from test where subject = 'k1' and source<60) as 语文
, (select count(source) from test where subject = 'k2' and source<60) as 数学
, (select count(source) from test where subject = 'k3' and source<60) as 英语
, (select count(source) from test where source<60) as 不及格
from test
group by a.name
order by a.name

----------------------------------------------
按此在新窗口浏览图片
=^@^=
作者:
男 zsredmoon (=^@^=) ★☆☆☆☆ -
盒子活跃会员
2004/3/8 16:46:02
3楼: 尚有一个问题待解决,
此方法未能控制合计行于最末,有哪位高手可以解决?
----------------------------------------------
按此在新窗口浏览图片
=^@^=
作者:
男 freewyl (freewyl) ★☆☆☆☆ -
盒子活跃会员
2004/3/8 16:56:16
4楼: 朋友,首先谢谢你,可是你的答案不适合我,我的问题是subject这一例是不固定的,你给的答案只适合subject固定列的算法。
----------------------------------------------
读好书可以净化心灵,交挚友能够升华人生。山外有山,能人背后自有更强能人在!
作者:
男 zsredmoon (=^@^=) ★☆☆☆☆ -
盒子活跃会员
2004/3/8 17:01:27
5楼: 你自己贴的那段脚本不就实现了subject不确定的方法了么?
----------------------------------------------
按此在新窗口浏览图片
=^@^=
作者:
男 freewyl (freewyl) ★☆☆☆☆ -
盒子活跃会员
2004/3/8 17:24:42
6楼: 是的,可是我想对其进行,行、列的统计却不知道怎么做,才能得如下结果:

姓名   数学   英语   语文    不及格科
李四   30     85     80       1科
王五   45     50     5作      3科
张三   8缺    100    60       1科
合计   3人    1人    1人      5人 

----------------------------------------------
读好书可以净化心灵,交挚友能够升华人生。山外有山,能人背后自有更强能人在!
作者:
男 freewyl (freewyl) ★☆☆☆☆ -
盒子活跃会员
2004/3/14 12:32:27
7楼: 怎么没人帮忙啊?救救命啊
----------------------------------------------
读好书可以净化心灵,交挚友能够升华人生。山外有山,能人背后自有更强能人在!
作者:
男 freewyl (freewyl) ★☆☆☆☆ -
盒子活跃会员
2004/3/15 15:32:32
8楼: 这个问题怎么没有人帮忙了呢?大哥大姐,小弟小妹帮帮忙啊?
----------------------------------------------
读好书可以净化心灵,交挚友能够升华人生。山外有山,能人背后自有更强能人在!
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行79.10156毫秒 RSS