Re: Retrieving Data from table based on Date and Time. - Mailing list pgsql-general

From Stephen Cook
Subject Re: Retrieving Data from table based on Date and Time.
Date
Msg-id 54549C41.1050001@gmail.com
Whole thread Raw
In response to Retrieving Data from table based on Date and Time.  (VENKTESH GUTTEDAR <venkteshguttedar@gmail.com>)
Responses Re: Retrieving Data from table based on Date and Time.  (VENKTESH GUTTEDAR <venkteshguttedar@gmail.com>)
List pgsql-general
On 11/1/2014 2:27 AM, VENKTESH GUTTEDAR wrote:
>     I have a table in which i have some few fields, in that few, one
> field is of date type and second one is of time data type, so now my
> question is how can i fetch the data with latest date and time, or the
> last inserted value from the PostgreSQL Table.?

SELECT     *
FROM     mytable
ORDER BY datecolumn DESC,
                 timecolumn DESC
LIMIT     1;


You might want to put an index on them.

-- Stephen



pgsql-general by date:

Previous
From: VENKTESH GUTTEDAR
Date:
Subject: Retrieving Data from table based on Date and Time.
Next
From: VENKTESH GUTTEDAR
Date:
Subject: Re: Retrieving Data from table based on Date and Time.