需求一个存储过程(汇总)。谢谢~~~~
3个表
表1
教师基本信息表 teacher_base
idteacher_iddepartment_idteacher_name
180011教师1
280021教师2
380032教师3
380042教师4
380053教师5
表2
部门信息表
iddepartment_iddepartment_name
11科系1
22科系2
33科系3
44科系4
表3
教师签到信息表
idteacher_idqiandao_date
112007-01-01
222007-01-02
312007-01-02
412007-01-03
532007-01-03
612007-01-04
722007-01-04
812007-01-05
得到的结果需要:
idteacher_namedepartment_name合计签到节数
这样的过程需要怎么来写呢?
[解决办法]
不明白
[解决办法]
没有具体的数量...
[解决办法]
为什么要给99分?不是100,不是50??
[解决办法]
教师基本信息表 teacher_base
idteacher_iddepartment_idteacher_name
180011教师1
280021教师2
380032教师3
380042教师4
380053教师5
id 怎么回事,什么关系?
[解决办法]
select R.teacher_id,R.count,B.teacher_name,D.department_name
(
Select distinct(teacher_id) AS teacher_id,count(*) AS count from class group by teacher_id
) AS R
Inner join base AS B
On B.teacher_id = R.teacher_id
Inner joib depart AS D
On D.department_id = B.department_id
[解决办法]
base:基础信息表
depart:部门表
class:签到表
[解决办法]
晕,那还不给分.................
呵欠...........