Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 426AF63429A for ; Mon, 18 May 2009 11:41:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 29341-10 for ; Mon, 18 May 2009 11:41:12 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from fafnir.androme.com (fafnir.androme.com [62.58.96.158]) by mail.postgresql.org (Postfix) with ESMTP id 49625634168 for ; Mon, 18 May 2009 11:41:13 -0300 (ADT) Received: by fafnir.androme.com (Postfix, from userid 1003) id 943A4B93E5F; Mon, 18 May 2009 16:41:10 +0200 (CEST) From: =?iso-8859-1?Q?Dani_Casta=F1os?= To: Subject: Extract week from date Date: Mon, 18 May 2009 16:41:09 +0200 Message-ID: <007d01c9d7c6$af6aac70$0e400550$@es> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcnXxq74Og+mdGIwSYSDioiwH0O+bg== Content-Language: es X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200905/81 X-Sequence-Number: 32573 Hi again, I need to extract date grouped by week from an statistics table. I was trying something like this: SELECT total_duration, EXTRACT( week from date statistics_date ) FROM statistics_daily GROUP BY EXTRACT( week from date statistics_date ), total_duration; But it doesn't works... Neither: SELECT total_duration, statistics_date FROM statistics_daily GROUP BY EXTRACT( day from statistics_date ), total_duration, statistics_date; How can it be done? Note: statistics_date is a DATE data type column. Regards. -- Dani Casta=F1os S=E1nchez dcastanos@androme.es