【发布时间】:2017-12-04 05:56:59
【问题描述】:
我有一个“数据库”,一个学生有两张表,然后注册。学生表有 stuid、lastname、firstname。登记表有 stuid 班级编号和年级。
我必须返回一个看起来像这样的列表
姓
伯恩斯
琼斯
李
麦卡锡
里维拉
史密斯
名字
爱德华 玛丽 佩里 欧文 简 汤姆
我试图做这样的声明
Select lastname, firstname
Where Not exists (Select stuid from enroll e where e.stuid = s.stuid)
Having count(*) < 3
Group By lastname, firstname;
我知道我基本上需要两个合并这两个表,以便我得到班级
【问题讨论】: