Re: [GENERAL] date ranges in where

2009-05-07 Thread Raymond O'Donnell
On 07/05/2009 12:59, Jasen Betts wrote: > where lastlogin::date between '2009-05-01'::date and '2009-05-02'::date > > If you leave it uncast postgres will probably convert the lastlogin to > a string and produce results other than that desired and proabaly > take longer to do it too. The OP was

Re: [GENERAL] date ranges in where

2009-05-07 Thread Jasen Betts
On 2009-05-06, Miguel Miranda wrote: > --00032557620e737136046944dbf1 > Content-Type: text/plain; charset=ISO-8859-1 > Content-Transfer-Encoding: 7bit > > Hi, what is the recommended way to select a range of dates? if you want to compare dates, use dates! > Lets say a have a table with a lastlog

Re: [GENERAL] date ranges in where

2009-05-06 Thread Craig Ringer
Erik Jones wrote: On May 6, 2009, at 2:19 PM, Adrian Klaver wrote: On Wednesday 06 May 2009 2:12:47 pm 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

Re: [GENERAL] date ranges in where

2009-05-06 Thread Erik Jones
On May 6, 2009, at 2:59 PM, Adrian Klaver wrote: On Wednesday 06 May 2009 2:51:08 pm Erik Jones wrote: On May 6, 2009, at 2:48 PM, Miguel Miranda wrote: Well, i tried all your sugestions, and i found some funny issues, i use the query to count exactly in a day by day basis, and running the qu

Re: [GENERAL] date ranges in where

2009-05-06 Thread Erik Jones
On May 6, 2009, at 2:55 PM, Miguel Miranda wrote: On Wed, May 6, 2009 at 3:51 PM, Erik Jones wrote: On May 6, 2009, at 2:48 PM, Miguel Miranda wrote: Well, i tried all your sugestions, and i found some funny issues, i use the query to count exactly in a day by day basis, and running

Re: [GENERAL] date ranges in where

2009-05-06 Thread Adrian Klaver
On Wednesday 06 May 2009 2:51:08 pm Erik Jones wrote: > On May 6, 2009, at 2:48 PM, Miguel Miranda wrote: > > Well, i tried all your sugestions, and i found some funny issues, i > > use the query to count exactly in a day by day basis, and running > > the query with > > > > WHERE lastlogin >= '2009

Re: [GENERAL] date ranges in where

2009-05-06 Thread Miguel Miranda
sorry, i edited the date, the correct one is 05-03-2009 12:00:00 AM If i group by day, it count 1 user for day 2009-05-03 in the output, so it adds 1 to the total count of the range regards On Wed, May 6, 2009 at 3:51 PM, Erik Jones wrote: > > On May 6, 2009, at 2:48 PM, Miguel Miranda wrote

Re: [GENERAL] date ranges in where

2009-05-06 Thread Erik Jones
On May 6, 2009, at 2:48 PM, Miguel Miranda wrote: Well, i tried all your sugestions, and i found some funny issues, i use the query to count exactly in a day by day basis, and running the query with WHERE lastlogin >= '2009-05-01' AND lastlogin < '2009-05-03' OR WHERE lastlogin >= 'X' AN

Re: [GENERAL] date ranges in where

2009-05-06 Thread Miguel Miranda
Well, i tried all your sugestions, and i found some funny issues, i use the query to count exactly in a day by day basis, and running the query with WHERE lastlogin >= '2009-05-01' AND lastlogin < '2009-05-03' OR WHERE lastlogin >= 'X' AND lastlogin <= 'Y' + '1 day'::interval it includes the 0

Re: [GENERAL] date ranges in where

2009-05-06 Thread Erik Jones
On May 6, 2009, at 2:19 PM, Adrian Klaver wrote: On Wednesday 06 May 2009 2:12:47 pm 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 20

Re: [GENERAL] date ranges in where

2009-05-06 Thread Erik Jones
On May 6, 2009, at 2:17 PM, Erik Jones wrote: On May 6, 2009, at 2:12 PM, 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

Re: [GENERAL] date ranges in where

2009-05-06 Thread Adrian Klaver
On Wednesday 06 May 2009 2:12:47 pm 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 simpl

Re: [GENERAL] date ranges in where

2009-05-06 Thread Erik Jones
On May 6, 2009, at 2:12 PM, 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 la

Re: [GENERAL] date ranges in where

2009-05-06 Thread Raymond O'Donnell
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 la

[GENERAL] date ranges in where

2009-05-06 Thread Miguel Miranda
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 b