Re: date ranges in where
От | Erik Jones |
---|---|
Тема | Re: date ranges in where |
Дата | |
Msg-id | FAC3D4F1-301E-4094-8FE7-FA12E0A853F1@engineyard.com обсуждение исходный текст |
Ответ на | date ranges in where (Miguel Miranda <miguel.mirandag@gmail.com>) |
Ответы |
Re: date ranges in where
Re: date ranges in where |
Список | pgsql-general |
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 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... WHERE lastlogin >= '2009-05-01' AND lastlogin < '2009-05-03' or, if the values have are some unknown X and Y dates then you can do this: WHERE lastlogin >= 'X' AND lastlogin <= 'Y' + '1 day'::interval Erik Jones, Database Administrator Engine Yard Support, Scalability, Reliability 866.518.9273 x 260 Location: US/Pacific IRC: mage2k
В списке pgsql-general по дате отправления: