求教mysql问题,查询学生表中的学生性别为男,且总成绩大于500. 本帖最后由 ACMAIN_CHM 于 2012-11-12 17:50:18 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 能用一个sql语句查询出所有性别为男总成绩大于500的学生么?成绩表中存储的单个科目的成绩。 select s.*from 学生表 s,成绩表 rwhere s.学生表的唯一标示=r.学生表的唯一标示and s.学生性别='男'group by s.学生表的唯一标示having sum(r.成绩)>500 select a.*from student a,score bwhere a.id=b.idand s.sex='男'group by a.idhaving sum(b.score)>500; select a.* from student a inner join (select id from scord group by id having sum(score)>500) bon a.id=b.idwhere sex='男' select * from 学生表 where 学生唯一标示 in(select 学生唯一标示 from 成绩表 where 性别='男' having sum(成绩)>=500) 上面的都把好的写了 我来写一个子查询,速度是慢了点,但是也可以赚分 INNODB,INSERT进入慢查询的问题 问个Select SQL语句 关于时间类型转换的问题。。。 mysql 两边数据转移怎么转? 关于mysql和cygwin的问题 改mysql查询语句应该怎么优化啊 mysql 死锁问题 自定义函数修改无效 sql语句求助!如何按某字段查询出最新颁布信息 从Mysql数据库服务器导出的sql文件,在本地导入时报错 show processlist\G 这是 什么情况啊 大虾们 频繁数据读取该如何设计?
from 学生表 s,成绩表 r
where s.学生表的唯一标示=r.学生表的唯一标示
and s.学生性别='男'
group by s.学生表的唯一标示
having sum(r.成绩)>500
from student a,score b
where a.id=b.id
and s.sex='男'
group by a.id
having sum(b.score)>500;
(select id from scord group by id having sum(score)>500) b
on a.id=b.id
where sex='男'