以下查询返回前 24 个随机记录,如下所示
SELECT top 24
ROW_NUMBER() OVER (ORDER BY QuestionID) AS QuestionNo,
Q.QuestionID,
CS.Section
FROM Questions Q
left join dbo.ChapterSection CS
on Q.SectionID=CS.SectionID
order by newid()
74 656 Section 3.1 - A long and illustrious history- Early Briton
183 765 Section 3.3 - A long and illustrious history-The Tudors and Stuarts
432 1017 Section 4.5 - A modern, thriving society - Arts and culture
我想要的是 QuestionNo 的值从 1 到 24 如下
1 656 Section 3.1 - A long and illustrious history- Early Briton
2 765 Section 3.3 - A long and illustrious history-The Tudors and Stuarts
3 1017 Section 4.5 - A modern, thriving society - Arts and culture
有任何想法吗?谢谢