一个表的某字段内容都作为另个表字段,并且要统计,请高手指点(没分了...)

todouwang 2004-11-05 10:27:20
现在有table1它有字段职称,系别等,我要在table2中按系别统计所有职称的人数,总计人数等。
table2中字段是这样:
系别, 总人数, 教授, 副教授.....
求一简单点的操作方法,谢了
...全文
117 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
todouwang 2004-11-08
  • 打赏
  • 举报
回复
方法不行呀
todouwang 2004-11-05
  • 打赏
  • 举报
回复
谢谢,我来试试看你们的方法,我以前自己写,只要我用into 它就提示into关键字错误,我用paradox表
Sorder 2004-11-05
  • 打赏
  • 举报
回复
有个地方写错了
insert table2 select a.系别,a.f1,b.f2,c.f3 from (select 系别,count(*) as f1 from table2 group by
系别)a,(select 系别,count(*) as f2 from table2 where 职称='教授' group by 系别)b,
(select 系别,count(*) as f3 from table2 where 职称='副教授' group by 系别)c
where a.系别=b.系别 and a.系别=c.系别
Sorder 2004-11-05
  • 打赏
  • 举报
回复
insert table2 select a.系别, from (select 系别,count(*) as f1 from table2 group by
系别)a,(select 系别,count(*) as f1 from table2 where 职称='教授' group by 系别)b,
(select 系别,count(*) as f1 from table2 where 职称='副教授' group by 系别)c
where a.系别=b.系别 and a.系别=c.系别
firetoucher 2004-11-05
  • 打赏
  • 举报
回复
FYI

http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=170924
todouwang 2004-11-05
  • 打赏
  • 举报
回复
顶!

2,496

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧