Hi
i use pagination for my datalist
and this is Store Procedure
ALTER procedure [dbo].[GetCustomersPageWise]
@PageIndex INT = 1
,@PageSize INT = 5
,@RecordCount INT OUTPUT
AS
BEGIN
SET NOCOUNT ON;
SELECT ROW_NUMBER() OVER
(
ORDER BY [ID] ASC
)AS RowNumber
,[ID]
,[Name]
,[Image]
,[Date]
,[Model]
INTO #Results
FROM [House_p]
SELECT @RecordCount = COUNT(*)
FROM #Results
SELECT * FROM #Results
WHERE RowNumber BETWEEN(@PageIndex -1) * @PageSize + 1 AND(((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1
DROP TABLE #Results
END
here
ORDER BY [ID] ASC
i have date column in my House_p table i want it order by this column but when i wrote this code
here
SELECT ROW_NUMBER() OVER
(
ORDER BY [Maxdate] desc
)AS RowNumber
,[ID]
,[Name]
,[Image]
,[Date]
,MAX(Date) as [Maxdate]
,[Model]
this error occur
Msg 207, Level 16, State 1, Procedure GetCustomersPageWise, Line 12
Invalid column name 'Maxdate'.
how i can define that it orderby max date?
thanks