我有一个 5 列的表(列是 id、answer、weight、quiz_id 和 question_id),我想按 question_id 对其进行排序,然后按 weihgt 排序,然后我想根据这种双重排序递增地重新编号 id 列。在 mysql 中是否有可能(我正在使用 phpmyadmin)?
谢谢
就像是:
SELECT
@curRow := @curRow + 1 AS id,
T.Answer, T.Weight, T.Quiz_Id, T.Question_Id
FROM wp_wpss_Answers T
JOIN (SELECT @curRow := 0) r
ORDER BY QuestioN_Id, Weight
LIMIT 0 , 1000