Re: Select 'Sunday' in month ??

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: "tjk(at)tksoft(dot)com" <tjk(at)tksoft(dot)com>
Cc: Tubagus Nizomi <nizomi(at)dnet(dot)net(dot)id>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Select 'Sunday' in month ??
Date: 2001-01-18 23:04:42
Message-ID: Pine.LNX.3.96.1010119000249.23930D-100000@ara.zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Wed, 17 Jan 2001, tjk(at)tksoft(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Brett W. McCoy 2001-01-18 23:46:57 Re: PostgreSQL HOWTO
Previous Message Bruce Momjian 2001-01-18 23:03:35 Re: PostgreSQL HOWTO