(2)如求用一条SQL语句 查询出每门课都大于80分的学生姓名
name kecheng fenshu
张三 语文 81
张三 数学 75
李四 语文 76
李四 数学 90
王五 语文 81
王五 数学 100
王五 英语 90
用这样的可以么。
1) select distinct name from table where not exists (select distinct name from table where fenshu <=80) 2)select distinct name from table where not exists (select distinct name from table name=table.name where fenshu <=80)
以上那个对?或是2个都不对?
最好比较一下错在那里。
name kecheng fenshu
张三 语文 81
张三 数学 75
李四 语文 76
李四 数学 90
王五 语文 81
王五 数学 100
王五 英语 90
用这样的可以么。
1) select distinct name from table where not exists (select distinct name from table where fenshu <=80) 2)select distinct name from table where not exists (select distinct name from table name=table.name where fenshu <=80)
以上那个对?或是2个都不对?
最好比较一下错在那里。
解决方案 »
- 求怎么导出job代码
- 求一SQL语句
- 数据字段aa为varchar型,可存的是整形数据,现在要求对该字段进行大于小于查询,请教高手!
- 在服务器上安装SQL SERVER 2005开发版 与 企业版有什么区别?
- 求助!!关于SQL Server 2005安装的问题!!
- sql 两个表查询问题,请教
- 一个复杂的问题,在线等。。出来就给分
- 40分求一sql语句
- 小小问题!!!come in
- 大家能帮帮我吗,我的sql server2000 sa的口令忘记了,但我又不想重装。请问sql server2000的口令放在哪儿???
- 在低档计算机上如何设计数据库结构,以便运行大型数据。
- sql语句锁定数据库表中的某些记录?
以上那个对?或是2个都不对?
最好比较一下错在那里。
----------------------------------------
你第一个根本不对,第二个是对的但是语法写错了!改为
select distinct name from [table] As A where not exists (select name from [table] where name=A.name And fenshu<=80)
select name from table group by name having min(fenshu)>=80