要求出现如下结果:
sql语句:
select a.rstime as 日期, a.胜, b.负
from
(select rstime, count(*)as 胜
from tabl
where result = ‘胜’
group by(rstime)) a,
(select rstime, count(8) as 负
from tabl
where result = ‘负’
group by(rstime))b
where a.rstime = b.rstime
查出每门课都大于80分学生的姓名
结果:
sql语句:
select names from grade a
where not exists
(select 1 from grade b
where b.names=a.names
and b.score<=80)
group by a.names