SELECT t1.Name,
t2.ClassName
FROM
(
SELECT rid = ROW_NUMBER() OVER (PARTITION BY dbo.Class.ClassID ORDER BY Class.ClassID),
*
FROM dbo.Student
) AS t1
INNER JOIN dbo.Class t2
ON t2.ClassID = t1.ClassID
WHERE t1.rid <= 10
sql语句写 俩张表 一个学生表 一个班级表 查询每个班级前10名学生
最新推荐文章于 2024-07-17 14:40:29 发布