access 分页用 SQL查询语句
select top 每页显示的记录数 * from topic where id not in (select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc) order by id desc
select top 每页显示的记录数 * from topic where id not in (select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc) order by id desc
相关文档:
在T-sql的写法上有很大的讲究,下面列出常见的要点:首先,DBMS处理查询计划的过程是这样的:
1、查询语句的词法、语法检查
2、将语句提交给DBMS的查询优化器
3、优化器做代数优化和存取路径的优化
4、由预编译模块生成查询规划
5、然后在合适的时间提交给系统处理执行
6、最后将执行结果返回给用户。
其次,看一下S ......
原始表:
name course score
-----------------------------------------
张三 语文 80
张三 & ......
/********************************
功能:获取表的空间分布情况
**********************************/
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tablespaceinfo]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
create table tablespaceinfo   ......
列出TableA中有的而TableB中没有, 以及B中有而A中没有的记录:
其中两个表的结构相同,选择的Key可以多个
Select Key from
( select * from TableA
Union select * from TableB
)
group by Key
having count(Key)=1
列出TableA中有的而TableB中没有的记录:
Select Key from
( (select * from TableA
Un ......