Re: Setting week starting day - Mailing list pgsql-general

From Ted Byers
Subject Re: Setting week starting day
Date
Msg-id 0be001c7629f$85135fb0$6401a8c0@RnDworkstation
Whole thread Raw
In response to Tabulate data incrementally  (Omar Eljumaily <omar2@omnicode.com>)
Responses Re: Setting week starting day
List pgsql-general
----- Original Message -----
From: "Omar Eljumaily" <omar2@omnicode.com>
To: "Ted Byers" <r.ted.byers@rogers.com>
Cc: <pgsql-general@postgresql.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



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Weird behaviour on a join with multiple keys
Next
From: Jorge Godoy
Date:
Subject: Re: Setting week starting day