Re: newbie question for return date - Mailing list pgsql-general

From Medi Montaseri
Subject Re: newbie question for return date
Date
Msg-id 3DBDE08A.9030009@intransa.com
Whole thread Raw
In response to Re: newbie question for return date  (Lee Harr <missive@frontiernet.net>)
Responses Re: newbie question for return date
Re: newbie question for return date
List pgsql-general
Hey a suggestion, what if PG would support the negative limit as in
select * from table limit -1 to mean limit it from the other end of
list.....

Sort of like some languages where they support

array[1] vs array[-1].

I'm not sure, but it looks like order by will sort the list which is
expensive and then
allow us to get the first chunk specified by limit.

Lee Harr wrote:

>In article <xEgv9.2668$h_4.374526@news20.bellglobal.com>, tviardot wrote:
>
>
>>Hi guys, here a newbies question.
>>I've made a table with some action and date.
>>How may i query the most recent date. (I'd like to return only the record
>>which have the most recent date ).
>>Tx
>>
>>
>>
>>
>
>How about:
>
>SELECT * FROM t ORDER BY d DESC LIMIT 1;
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo@postgresql.org so that your
>message can get through to the mailing list cleanly
>
>




pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Formatting query output
Next
From: Hadley Willan
Date:
Subject: User functions not displayed by \df