On 06/05/2009 22:12, Miguel Miranda wrote:
> Hi, what is the recommended way to select a range of dates?
> 
> Lets say a have a table with a lastlogin (timestamp) column and i want
> toknow what users logged in for last time between 2009-05-01 and 2009-05-02?
> 
> I know that a simple
> 
> where lastlogin between '2009-05-01' and '2009-05-02' doesnt work beacuse it
> doesnt include who logged in 2009-05-02 15:30:00, etc...

Why not just include the time in the comparisons?

  ....between '2009-05-01 00:00'::timestamp
        and '2009-05-02 23:59:59'::timestamp

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
r...@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to