Finding last day in a month

Поиск
Список
Период
Сортировка
От Paul Makepeace
Тема Finding last day in a month
Дата
Msg-id 20041019121848.GC22444@mythix.realprogrammers.com
обсуждение исходный текст
Ответы Re: Finding last day in a month  (Doug Silver <dsilver@urchin.com>)
Список pgsql-novice
This is perhaps more of a style question. I'm trying to find the 'right'
way with date/time functions to pull out the last day in a month from a
set of data that might contain rows that don't fall on the actual last
date (e.g. Friday 2004-07-30)

 Foo.info_at("2004-07") # contains some logic to make "2004-07-%" for:

 WHERE foo_date LIKE ? ORDER BY foo_date DESC LIMIT 1

This feels quite hacky to me for some reason but at least seems to work.

(I'd originally had foo_date = ?::date+'1month'::interval-'1day'::interval !)

Paul


--
Paul Makepeace .............................. http://paulm.com/inchoate/

"What is do I smell? A thousand paths to choose."
   -- http://paulm.com/toys/surrealism/

В списке pgsql-novice по дате отправления:

Предыдущее
От: Paul Makepeace
Дата:
Сообщение: Re: VIEWs with aggregate functions
Следующее
От: "Keith Worthington"
Дата:
Сообщение: finding data violating constraint