Perfil de Zhong简单做人FotosBlogListasMás ![]() | Ayuda |
|
14 mayo Paging SQL前些时候面试,有个问题是问我Web Paging SQL,我若干年前解决过n遍,可是记性真差,居然答不上来,具汗。从网上看到整理如下:
Oracle:
select * from (select row_.*, rownum rownum_ from (Your_SQL ) row_ where rownum <= max) where rownum_ >= min
SQL Server:
select top @pagesize * from tablename where id not in (select top @pagesize*(@page-1) id from tablename order by id) order by id
MySQL:
select * from tablename limit position, counter
DB2
select * from (select *, rownumber() as ROW_NEXT from tablename) where ROW_NEXT between min and max
这个SQL Server的Paging SQL比较难看,我相信SQL2005已经支持类似rownumber的功能。 Comentarios (4)Para agregar un comentario, inicia sesión con tu cuenta de Windows Live ID (si utilizas Hotmail, Messenger o Xbox LIVE, ya tienes una cuenta de Windows Live ID). Iniciar sesión ¿No tienes una cuenta de Windows Live ID? Regístrate
Vínculos de referenciaLa dirección URL del vínculo de referencia de esta entrada es: http://zlit.spaces.live.com/blog/cns!8861E8E763F023DA!155.trak Weblogs que hacen referencia a esta entrada
|
|
|