...查询没有参加考试的学生名单,要求显示姓名、学号,具体请补充:_百度...

发布网友 发布时间:2024-09-28 02:06

我来回答

2个回答

热心网友 时间:2024-09-28 02:15

SELECT
*
FROM
member
WHERE
NOT EXISTS (
SELECT 1
FROM
score
WHERE
member.mid = score.mid
);

mid mname
---------- --------------------------------------------------
M005 阳阳
M010 香奈儿

(2 行受影响)

这个结果?

热心网友 时间:2024-09-28 02:10

用游标来做:
declare cur cursor for select mid from member
open cur
declare @mid varchar(50)
fetch cur into @mid
while(@@fetch_status=0)
begin
--select @mid
select @mid,a.fname from course a where a.fid not in (select fid from score where mid=@mid)
fetch cur into @mid
end
close cur
deallocate cur

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com