Sql Server 2005
Структура таблицы
CREATE TABLE [dbo].[Rate](
[RateID] [bigint] IDENTITY(1,1) NOT NULL,
[PairID] [bigint] NOT NULL,
[Open] [decimal](18, 4) NOT NULL,
[Close] [decimal](18, 4) NOT NULL,
[High] [decimal](18, 4) NOT NULL,
[Low] [decimal](18, 4) NOT NULL,
[Difference] [decimal](18, 4) NOT NULL,
[Average] [decimal](18, 4) NOT NULL,
[Percentage] [decimal](18, 4) NOT NULL,
[InfoDate] [datetime] NOT NULL,
[Hourly] [bit] NOT NULL,
[CaptureDateTime] [datetime] NULL,
CONSTRAINT [PK_Rate] PRIMARY KEY CLUSTERED
(
[RateID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Я использую пейджинг для извлечения таблицы как таковой
Select * from(
SELECT
(ROW_NUMBER()OVER (ORDER BY InfoDate ASC)) AS RowNo,
[RateID],
[PairID],
[Open],
[Close],
[High],
[Low],
[InfoDate],
[CaptureDateTime]
From Rate
) AS T
WHERE t.RowNo
BETWEEN 200*@PageNumber AND 200 * (@PageNumber+1)-1
ORDER BY RowNo DESC
[Вопрос]
Мне нужен запрос, который даст мне эту таблицу
PageNo, StartIndex (первый RateId на этой странице), EndIndex (последний RateId на этой странице), StartDate (первая инфо-дата на этой странице), EndDate (последняя инфо-дата на этой странице).