[NOVICE] Please advice on a query - Mailing list pgsql-novice

From JORGE MALDONADO
Subject [NOVICE] Please advice on a query
Date
Msg-id CAAY=A79ZptiQ-MirLFGxjEoWc5_gJWT2XH3zqQoBJ5BFSZPBGg@mail.gmail.com
Whole thread Raw
Responses Re: [NOVICE] Please advice on a query  (Efraín Déctor <efraindector@motumweb.com>)
List pgsql-novice
I have a table with a date field and I need to get all of the records with the most recent date.
For example, if I have the following records, I need to get all of them with date 2017-11-09 only. which represent the most recent.

What would be a good approach?

2017-01-01
2017-01-01
2017-10-15
2017-10-15
2017-10-15
2017-11-09
2017-11-09
2017-11-09
2017-11-09

I thought about issuing a SELECT DISTINCT to get one record for each date, ORDER BY date DESC and then LIMIT 1 so I finally get the most recent date and use it in the WHERE clause. But this seems to me a bit complex.

Respectfully,
Jorge Maldonado

pgsql-novice by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: [NOVICE] Strange problem with autovacuum
Next
From: Efraín Déctor
Date:
Subject: Re: [NOVICE] Strange problem with autovacuum