请教SQL语句怎么写

[复制链接]
查看11 | 回复3 | 2010-4-8 12:11:41 | 显示全部楼层 |阅读模式
tb_user用户表tb_course课程表tb_mark成绩表sql语句:select * from tb_user where user_no in( select tmp.user_no from
(select user_no from tb_mark where mark='A') tmp
group by tmp.user_no
having count(*)=(select count(*) from tb_course));
回复

使用道具 举报

千问 | 2010-4-8 12:11:41 | 显示全部楼层
select * from 用户表where user_no not in( select user_no from 成绩表 where mark!='A')
回复

使用道具 举报

千问 | 2010-4-8 12:11:41 | 显示全部楼层
设第一个表名为user,第二个表名为courseselect user.user_no, user.user_name, course_id,mark from user,course where user.user_no=course.user_no and mark='A'
回复

使用道具 举报

千问 | 2010-4-8 12:11:41 | 显示全部楼层
是要找用户成绩为A的课程,还是要找所有课程成绩都为A的用户啊
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行