mysql中给查询出的结果集添加自增序号

SELECT
( @i := @i + 1 ) i,
option_s.option_id
FROM
( SELECT option_id FROM dcs_survey_option WHERE question_id = 141886645 ORDER BY question_id, option_type, sort ) AS option_s,(
SELECT
@i := 0
) t

posted on 2022-03-08 18:51  会学习的猪  阅读(495)  评论(0编辑  收藏  举报

导航