Re: newbie question for return date

From: Richard Huxton <dev(at)archonet(dot)com>
To: "tviardot" <tviardot(at)sympatico(dot)ca>, pgsql-general(at)postgresql(dot)org
Subject: Re: newbie question for return date
Date: 2002-10-30 18:45:30
Message-ID: 200210301845.30758.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday 28 Oct 2002 7:57 pm, 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 ).

SELECT * from table_name ORDER BY date_column DESC LIMIT 1;

If you have an index on date_column this will be almost instant. If two rows
have the same (largest) value in date_column which gets returned isn't well
defined.

--
Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Medi Montaseri 2002-10-30 18:49:28 Re: how to terminate a process when kill fails
Previous Message Dave Thompson 2002-10-30 18:43:02 Re: DAFS?