1

我有一张桌子domain,里面有name, alexarank, ind.

我知道如何以默认顺序枚举所有行:

UPDATE domain SET ind = (SELECT @a := @a + 1 FROM (SELECT @a := 0) s);

请建议如何枚举它们按 alexarank 排序。

4

1 回答 1

3
UPDATE domain SET ind = (SELECT @a := @a + 1 FROM (SELECT @a := 0) s) ORDER BY something;

如中所述:http ://dev.mysql.com/doc/refman/5.6/en/update.html

于 2012-09-29T18:33:59.643 回答