已知下表
+-----+-----------+-------+
| sno | gradeName | score |
+-----+-----------+-------+
| 1 | 语文 | 80 |
| 2 | 数学 | 80 |
| 3 | 英语 | 100 |
| 4 | 英语 | 90 |
+-----+-----------+-------+
显示的结果
gradeName score score
英语 100 90
sql怎么写
+-----+-----------+-------+
| sno | gradeName | score |
+-----+-----------+-------+
| 1 | 语文 | 80 |
| 2 | 数学 | 80 |
| 3 | 英语 | 100 |
| 4 | 英语 | 90 |
+-----+-----------+-------+
显示的结果
gradeName score score
英语 100 90
sql怎么写
解决方案 »
- 安装Oracle 11g出现以下问题
- json的一个输出模版插件问题
- ssh2表单验证用什么比较好?
- 高手给看看 cookie
- 用compass和lucene做全文搜索商品时,返回多张图片的名称??
- LINUX下运行JAVA程序????????/
- java菜鸟求救高手推荐一本java入门的好书 最最基础的 没有语言基础,零基础,好心人推荐个好书,推荐客观些,java菜鸟求救高手推荐一本j
- 高分求教:请问如何把tomcat里的catalina.out输出变小?
- 以下web.ini配置出错请问何解
- 求ssh整合开发快速教程,能搭起来一个小功能就行,入门一下。
- RemoteCacheServerFactory.startup疑问
- 把jsp改成html里边的标签怎么办啊???、急
希望对你有用。不知道你是想在什么地方查啊!
-> ( sno int primary key auto_increment,
-> gradeName varchar(4),
-> score int
-> ); mysql> insert into testcsdn (gradeName,score) values('Chinese',80);
Query OK, 1 row affected, 1 warning (0.00 sec) mysql> insert into testcsdn (gradeName,score) values('math',80);
Query OK, 1 row affected (0.00 sec) mysql> insert into testcsdn (gradeName,score) values('English',100);
Query OK, 1 row affected, 1 warning (0.00 sec) mysql> insert into testcsdn (gradeName,score) values('English',90);
Query OK, 1 row affected, 1 warning (0.00 sec) mysql> select *from testcsdn;
+-----+-----------+-------+
| sno | gradeName | score |
+-----+-----------+-------+
| 1 | Chin | 80 |
| 2 | math | 80 |
| 3 | Engl | 100 |
| 4 | Engl | 90 |
+-----+-----------+-------+
4 rows in set (0.00 sec) mysql> select a.gradeName,a.score,b.score from testcsdn a,testcsdn b
-> where a.gradeName=b.gradeName and
-> a.score !=b.score;
+-----------+-------+-------+
| gradeName | score | score |
+-----------+-------+-------+
| Engl | 90 | 100 |
| Engl | 100 | 90 |
+-----------+-------+-------+
2 rows in set (0.00 sec) 这里出来两条,因为你没有告诉我成绩怎么排,低在前还还高在前 ======================
不过,一般是没有这种用法的,
出现这样的情况可能是设计数据库的时候没有用三范式规范起来! 给分吧.谢谢!
你期待的结果是:
gradeName score score score score .....
英语 100 90 ... ...
这样?
就是一条查询加个条件啊
select score form table ××× where gradeName = "英语"