Trabalhar com paginação de dados no PostgreSQL é muito fácil. As cláusulas usadas para paginação são LIMIT e OFFSET. A fórmula básica seria o seguinte:

   1: SELECT * FROM tabela 
   2:     LIMIT <número de itens por página> 
   3:     OFFSET(<página> - 1) * <número de itens por página>

Agora, os exemplos… Para trazer os 20 registros da página 2:

   1: SELECT * FROM tabela 
   2:     LIMIT 20
   3:     OFFSET (2 - 1) * 20
Muito fácil! :)

Posted in: PostgreSQL  Tags: ,

Comments


December 28. 2009 02:08
personal loans
I don’t usually reply to posts but I will in this case. WoW Smile

http://www.globalpaydayloans.com/http://www.globalpaydayloans.com/


February 11. 2010 14:03
teeth whitening
I just hope to have understood this the way it was meant

http://www.super-teeth-whitening.net/http://www.super-teeth-whitening.net/


February 14. 2010 00:59
Herbal colon cleanse
I am not really sure if best practices have emerged around things like that, but I am sure that your great job is clearly identified. I was wondering if you offer any subscription to your RSS feeds as I would be very interested and can?t find any link to subscribe here.

http://www.super-colon-cleanses.com/http://www.super-colon-cleanses.com/


February 25. 2010 10:01
pay day loans
This is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free. It?s the old what goes around comes around routine.

http://www.sonicloans.net/http://www.sonicloans.net/


February 27. 2010 06:38
personal loans
Wow! Thank you! I always wanted to write in my site something like that.

http://www.flyingloans.com/http://www.flyingloans.com/

Páginas

Calendário

«  September 2010  »
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910
View posts in large calendar