Re: Setting week starting day

From: "Ted Byers" <r(dot)ted(dot)byers(at)rogers(dot)com>
To: "Omar Eljumaily" <omar2(at)omnicode(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Setting week starting day
Date: 2007-03-09 23:06:06
Message-ID: 0be001c7629f$85135fb0$6401a8c0@RnDworkstation
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


----- Original Message -----
From: "Omar Eljumaily" <omar2(at)omnicode(dot)com>
To: "Ted Byers" <r(dot)ted(dot)byers(at)rogers(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Friday, March 09, 2007 5:00 PM
Subject: Re: [GENERAL] Setting week starting day

> Ted, my reason for asking the question that I believe precipitated this
> thread was that I wanted a single sql statement that aggregated time data
> by week. Yes, I could do the aggregation subsequently in my own client
> side code, but it's easier and less error prone to have it done by the
> server.
>
I don't buy the suggestion that server side code is less error prone that
client side code, but be that as it may, we're talking about a function that
has one line of code. And given what you just said, you don't want the day
of the week, you want a function that returns the week of the year. This
can be had from the same Perl functions I mentioned before, with a minor
alteration in how you call it. my suggestion would be to create that one
line function that invokes the relevant Perl function, which can then be
invoked in your select statement (presumably with a group clause to avoid
mixing data from different years). It should take about ten to fifteen
minutes to write and test?

Ted

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jorge Godoy 2007-03-09 23:13:11 Re: Setting week starting day
Previous Message Tom Lane 2007-03-09 23:04:12 Re: Weird behaviour on a join with multiple keys