select * from table where not exists(select * from table where 学号=table.学号 and 成绩<=80)
select * from table t where not exists(select * from table where t.学号=学号 and 成绩<=80)
我想問一下,XS表中的課程號都是選修的課程號嗎? 如果是的話那就簡單了SELECT * FROM xs WHERE 成績>80如果你是在編程中用到的話那要傳遞參數 select * from xs where 學號=:No and 成績>80 其中:No為傳遞參數用如果你的XS表中不全是選修的課程號,那在where語句中還要加一個條件限制。
select * from table where 学号 not in (select 学号 from table where 成绩 <80)
not exists(select * from table where 学号=table.学号
and 成绩<=80)
not exists(select * from table where t.学号=学号
and 成绩<=80)
如果是的話那就簡單了SELECT * FROM xs WHERE 成績>80如果你是在編程中用到的話那要傳遞參數
select * from xs where 學號=:No and 成績>80
其中:No為傳遞參數用如果你的XS表中不全是選修的課程號,那在where語句中還要加一個條件限制。