select id,sid,sname
from
(
select c.id,
c.sid,
s.sname,
--这里按照@@servername来排序,
--你可以根据需要按照id,sid,sname等字段来排序
(row_number() over(order by @@servername) - 1) / @page_size as rownum
from commet c
inner join student s
on c.sid = s.sid
)t
where rownum = @page_num - 1