Re: Selecting weekdays from datetime

Поиск
Список
Период
Сортировка
От Bill Morrow
Тема Re: Selecting weekdays from datetime
Дата
Msg-id 39E32D92.CDDBE2E7@home.com
обсуждение исходный текст
Ответ на Selecting weekdays from datetime  (Martin Christensen <factotum@mail1.stofanet.dk>)
Список pgsql-novice
Martin Christensen wrote:
>
> Howdy,
>
> I have a database of mailing list entries where I would like to do
> some statistics on activity on different days of the week. So say I
> want to do something along the hypothetical lines of
>
> SELECT COUNT(*) FROM table WHERE day_of_week(date) = 'Mon'
>
> how do I go about doing that?
>
> Martin
>

I believe

select count(*) from table where where to_char(day, 'Day') =
'Monday   '

should do it. Note the three space pad on the end of
'Monday   '
to make it the same length as 'Wednesday'

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

Предыдущее
От: Martin Christensen
Дата:
Сообщение: Selecting weekdays from datetime
Следующее
От:
Дата:
Сообщение: About index ...