getting the last N tuples of a query

From: "Edmundo Robles L(dot)" <erobles(at)sensacd(dot)com(dot)mx>
To: "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: getting the last N tuples of a query
Date: 2010-07-08 23:17:33
Message-ID: 252EE06031407243B058CF7699226E3A0F89A3@mail2.sensacd.com.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

if a want the first 5,10,N tuples of a query (even without order)
i just have to do a:
select * from table limit 10;

but, What can i do to get the last 10 tuples ???
i try to do:
select * from table limit -10; :-D but that query return 0 tuples .

So, what is the right way to do that with no order????

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ben Chobot 2010-07-08 23:32:52 Re: getting the last N tuples of a query
Previous Message Carlo Stonebanks 2010-07-08 21:56:45 Wrote a proc for massive updates - will I have problems?