表结构
CREATE TABLE t_score(
name VARCHAR(255) NOT NULL PRIMARY KEY,
kemu VARCHAR(255) NOT NULL,
socre INT NOT NULL )ENGINE=Myisam CHARSET=utf8;
数据
+------+------+-------+
| name | kemu | score |
+------+------+-------+
| t | x | 81 |
| y | x | 81 |
| u | x | 82 |
| i | x | 82 |
| t | z | 80 |
| y | z | 81 |
| u | z | 81 |
| i | z | 79 |
+------+------+-------+
查询语句
select * from t_score group by name having order by name;
错误信息
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by kemu' at line 1
已解决 去掉having 怪我基础太差— —
where —》 group by —》having —》order by
表结构的score字段已经修正过了