问一个MySQL的问题
table1名次|分数
------
0 | 90
0 | 80
0 | 70
0 | 60
用MySQL如何把正确排列'名次',如下面的表:
名次|分数
------
1 | 90
2 | 80
3 | 70
4 | 60
感激!!!
SELECT 名次 AS (AUTO_INCREMENT_FUN)
FROM table1
ORDERBY 分数 DESC
不行啊!~~
mysql> select i as (AUTO_INCREMENT_FUN) from tt order by j desc;
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 '(AUTO
_INCREMENT_FUN) from tt order by j desc' at line 1
mysql> AUTO_INCREMENT_FUN是个例子,你需要借助函数来实现的
学习SQL还是用PostgreSQL好 SELECT * FROM 表ORDERBY 分数 DESC
不要动不动就照抄,学会自己思考,不然你还学习干什么?
页:
[1]