On Thu, Aug 27, 2009 at 08:36:45PM +0200, Thomas Kellerer wrote:
> BlackMage wrote on 27.08.2009 20:09:
> >I only want to select events happening for the current week(Mon-Sun).
>
> SELECT *
> FROM the_table
> WHERE extract(week from the_date_column) = extract(date from current_date);
The OP leaves it somewhat open, but wouldn't date_trunc be better here?
Something like:
SELECT * FROM the_table
WHERE date_trunc('week',the_date_column) = date_trunc('week',CURRENT_TIMESTAMP);
Otherwise you'll end up getting values for other years as well as the
current one.
--
Sam http://samason.me.uk/