要是这样的话,在每个表后面加上:
ID INT UNSIGNED NOT NULL AUTO_INCREMENT
mysql>select
*
from
a
+-----+
|
col
|
+-----+
|
0
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
+-----+
8
rows
in
set
(0.00
sec)
mysql>
set
@i
:=
0
select
@i
:=
@i
+
1
as
`order`,
a.*
from
a
order
by
col
desc
+-------+-----+
|
order
|
col
|
+-------+-----+
|
1
|
7
|
|
2
|
6
|
|
3
|
5
|
|
4
|
4
|
|
5
|
3
|
|
6
|
2
|
|
7
|
1
|
|
8
|
0
|
+-------+-----+
8
rows
in
set
(0.00
sec)
mysql>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)