查询出成绩不小于80的人的姓名

sql表结构如下

username  corse  score

   1   math   87
   1   english  70
   2   math   72
   2   chinese  90
   3   math   90
   3    english  98
   3    chinese  89

解决思路:

1)查询出成绩小于80的人的姓名:SELECT username from  scoretable WHERE score <80

2)之后查询表中名字不在上述结果中的人

SELECT distinct username from  scoretable WHERE username NOT  in (SELECT username from  scoretable WHERE score <80)

 

--有的时候生活不必追究于结果,换个思路,真的海阔天空。

 

posted on 2014-09-06 00:02  依米艳  阅读(375)  评论(0编辑  收藏  举报

导航