pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dani Castaños <dcastanos@androme.es>
To: pgsql-sql@postgresql.org
Subject: Extract week from date
Date: Mon, 18 May 2009 16:41:09 +0200
Message-ID: <007d01c9d7c6$af6aac70$0e400550$@es> (raw)

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ños Sánchez
dcastanos@androme.es





view thread (3+ messages)  latest in thread

Message-ID: <007d01c9d7c6$af6aac70$0e400550$@es>
Permalink:  ../007d01c9d7c6$af6aac70$0e400550$@es/
Also on:    postgresql.org/message-id/007d01c9d7c6$af6aac70$0e400550$@es

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dcastanos@androme.es
  Subject: Re: Extract week from date
  In-Reply-To: <007d01c9d7c6$af6aac70$0e400550$@es>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox