Re: First day of month, last day of month

Поиск
Список
Период
Сортировка
От Frank Bax
Тема Re: First day of month, last day of month
Дата
Msg-id 48108813.6070401@sympatico.ca
обсуждение исходный текст
Ответ на Re: First day of month, last day of month  (Frank Bax <fbax@sympatico.ca>)
Ответы Re: First day of month, last day of month  (Colin Wetherbee <cww@denterprises.org>)
Список pgsql-sql
Frank Bax wrote:
> Nacef LABIDI wrote:
>> is there a better method to retrieve all the rows with dates in the 
>> current month.
> 
> 
> select * from mytable where extract(month from mydate) = extract(month 
> from now()) and extract(year from mydate) = extract(year from now());


Sorry; I was not thinking clearly - date_trunc is better for this:

select * from mytable where date_trunc('month',mydate) = 
date_trunc('month',now());


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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: First day of month, last day of month
Следующее
От: "Anoop G"
Дата:
Сообщение: How I can check a substring is a valid number in postgresql ?