sql查询谁能帮我看下哪里错了
来源:百度知道 编辑:UC知道 时间:2024/05/25 06:40:36
from students a,scoreitem b, score
where (a.studentid=b.studentid)
and (score.adate>='2008-1-1' and score.adate<='2008-6-30')
and (score.testid=scoreitem.testid)
order by a.studentid asc
sum(b.ascore)
这里的问题..
改成.
select a.studentid, a.studentname, sum(b.ascore)
from students a,scoreitem b, score
where (a.studentid=b.studentid)
and (score.adate>='2008-1-1' and score.adate<='2008-6-30')
and (score.testid=scoreitem.testid) group by a.studentid,a.studentname
order by a.studentid asc
select a.studentid, a.studentname, sum(b.ascore)
from students a,scoreitem b, score c
where a.studentid=b.studentid and c.testid=a.testid
and c.adate>='2008-1-1' and c.adate<='2008-6-30'
order by a.studentid asc
这样才对
select a.studentid, a.studentname, sum(b.ascore)
from students a,scoreitem b, score
where (a.studentid=b.studentid)
and (score.adate>='2008-1-1' and score.adate<='2008-6-30')
and (score.testid=scoreitem.testid) group by a.studentid,a.studentname
order by a.studentid asc