oracle 分页查询

oracle 分页查询

分页

分别传入页数page和页大小size,

select * from ( select t.,rownum rn from t WHERE rownum <= pagesize ) tt where tt.rn>(page-1)*size;

 select * from ( select t.*,rownum rn from  t WHERE rownum <= 1*10 ) tt where tt.rn>0*10;
 select * from ( select t.*,rownum rn from  t WHERE rownum <= 2*10 ) tt where tt.rn>1*10;
 select * from ( select t.*,rownum rn from  t WHERE rownum <= 3*10 ) tt where tt.rn>2*10;

连接表注意事项:(2013-01-11)

SELECT * FEOM AA A

INNER JOIN BB B ON A.M=B.M

INNER JOIN CC C ON A.M=C.M

INNER JOIN DD D ON A.M=C.M

如以上语句,有三个连接语句或以上就会出错。

原因:BB CC DD 表别名要大写 ,A的M“字段名” 也要大写,且将INNER JOIN 语句写在一行,否则会出错

(2013-01-21) 好像不是以上原因,具体还待考究,高手路过请讲解下

连接区别(2013-01-12)

inner join: 只显示两表共有的数据


A.a    B.a


left join :以左表为准,并显示出相关联的B表信息


A.a    B.a

C.c


posted @ 2013-03-25 11:24  心存善念  阅读(263)  评论(0)    收藏  举报