2017-07-18 89 views
-1

我正在尝试一个非常艰难的选择...希望你能帮助我。Sql请求:根据另一个表中的值在表中选择

这是事情。 I have these two tables

我要选择“学生”每个人都没有“unique_key” =谁也:myvalue的在“出勤”表

例如: 与价值3_2017-07-10,我想请选择2,4,5 与值3_2017-07-17,我想选择3,4

我尝试了一些左连接,我尝试了一些不存在......徒然。 我只是找不到一个方法来做到这一点。

任何想法?

非常感谢!

回答

0

http://sqlfiddle.com/#!9/1e4a515/1

Select * from students where id not in (Select id_eleve from attendance where unique_key='3_2017-07-10'); 
Select * from students where id not in (Select id_eleve from attendance where unique_key='3_2017-07-17'); 
相关问题