Query with LIMIT clause

From: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Query with LIMIT clause
Date: 2012-09-09 17:25:48
Message-ID: CAAY=A7-v4-iSVgrapiFjq4wujyVqyW-7s0vsJHu7dLb93g__eA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have the following records that I get from a query, the fields are date
type in day/month/year format:

-------------------------------------
Initial Final
Date Date
-------------------------------------
27/08/2012 04/09/2012
29/08/2012 09/09/2012
28/08/2012 09/09/2012
30/08/2012 09/09/2012
30/08/2012 09/09/2012
27/08/2012 09/09/2012
31/08/2012 09/09/2012
28/08/2012 10/09/2012
05/09/2012 16/09/2012

As you can see, this result is ordered by Final Date. What I need is to get
the last 5 records only. If I use the LIMIT 5 clause I get the first 5. I
have tried an ORDEY BY DESC but the result is the same. I will very much
appreciate your comments.

Respectfully,
Jorge Maldonado

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David Johnston 2012-09-09 17:45:25 Re: Query with LIMIT clause
Previous Message David Johnston 2012-09-08 23:42:42 Re: returning values to variables from dynamic SQL