一个ACCESS 很简单的分页查询,不知道哪错了
"SELECT TOP " + pageSize + " * FROM [Works] WHERE (Id >(Select MAX([Id]) FROM (SELECT TOP " + pageSize * pageIndex + " [Id] FROM [Works] ORDER BY [Id]))) ORDER BY [Id] DESC"
总是提示:SELECT 子句中包含一个保留字、拼写错误或丢失的参数,或标点符号不正确。
Works表中Id字段为标识自增列
------解决方案--------------------对了,还要加别名
"SELECT TOP " + pageSize + " * FROM [Works] WHERE (Id >(Select MAX([Id]) FROM (SELECT TOP " + pageSize * pageIndex + " [Id] FROM [Works] ORDER BY [Id] desc)as t1)as t2)as t3 ORDER BY [Id] DESC"