select
row_number() over (order by BookTitle) AS Row,
BookTitleID,
BookTitle,
CallNumber,
FullName,
count(case Status when 'OnShelf' then 1 else null end) AS CopiesOnShelves
from
(
select
Book.BookTitleID,
BookTitles.BookTitle,
BookTitles.CallNumber,
Book.Status,
FullName = LastName + ', ' + FirstName + ' ' + MiddleName
From
Book
left outer join
BookTitles
on BookTitles.BookTitleID = Book.BookTitleID
left outer join
Authors
on Authors.AuthorID = BookTitles.AuthorID ) sub
Where Row between 1 and 10 -- not working
Group By Callnumber, BookTitle, BookTitleID, FullName
在此示例中,我将如何使用 In between ROW 来显示第 1 行到第 10 行。