Обсуждение: Select 'Sunday' in month ??

Поиск
Список
Период
Сортировка

Select 'Sunday' in month ??

От
Tubagus Nizomi
Дата:
i want to select date in january where day='Sunday'

any idea ??

please help me

Nizomi


Re: Select 'Sunday' in month ??

От
"tjk@tksoft.com"
Дата:
E.g.

create table mytable (created datetime);
insert into mytable values ('01-01-2001');
...
insert into mytable values ('01-31-2001');

select created from mytable where date_part('dow', created) = 7 and date_part('month', created) = 1;


Troy

> 
> i want to select date in january where day='Sunday'
> 
> any idea ??
> 
> please help me
> 
> Nizomi
> 



Re: Select 'Sunday' in month ??

От
Karel Zak
Дата:
On Wed, 17 Jan 2001, tjk@tksoft.com wrote:

> E.g.
> 
> create table mytable (created datetime);
> insert into mytable values ('01-01-2001');
> ...
> insert into mytable values ('01-31-2001');
> 
> select created from mytable where date_part('dow', created) = 7 and date_part('month', created) = 1;
> 
This will faster (one function call instead two):
..... where to_char(created, 'D/MM') = '7/01';
            Karel