www.emsdn.com
Class Profile: Home »» Databases [Databases] under "Databases" »»» Potentially annoying question about date ranges (part 2)

Potentially annoying question about date ranges (part 2)


I have a similar question,
I receive payments, but not every day (or even every week),
and I would like see how much I receive per week and/or per
month. I also need to compare different years.
I also would like to see what the (accumulated) sum of the
payments is at the end of a given week, month.
And then of course I would like to show this to someone, ie
make a graph. X-Axis 12 months (or 52 weeks). Left X-Axis the amounts
for the bars which should be in different colors (per month/bar), right
Y-Axis the amounts for the totals as a line (so that the bars don't
become too flat).
If such a combined graph is not possible/feasible, I could live with
one plot each per year.
I got the usual tools on the Mac, including R, gnuplot and fink.
any help would be appreciated.
el
on 9/30/06 8:34 PM Jan Danielsson said the following:
I'm going to assume that this question has been asked a gazillion
times, and is in every SQL book known to man and aliens. And I also
assume it is in the FAQ. But I'm going to ask anyway.
I have a database in which I store my purchases -- mainly for
entertainment (you have no idea how dull my life is).
In an effort to get some variation in my life, I thought I'd find
out how much of my valuable money I waste each day - on average.


No. 1# | By Developer Tags User at [2008-5-5] | size: 1185 bytes

, , ,

Practical PostgreSQL, Chapter 5, date_part(), to_char()

I got it :-)

el

on 10/8/06 9:43 AM Eberhard Lisse said the following:
Thank you very much.

Sorry to be unclear, they are time stamped, and I wondered if someone
could give me ssome advise how I do this aggregation. In particular do
I not know how to write such a scalar function.

Anything re-usable lying around as examples somewhere?

el

on 10/4/06 9:46 PM Guy Rouillier said the following:
>Eberhard Lisse wrote:

I receive payments, but not every day (or even every week),
and I would like see how much I receive per week and/or per month. I
also need to compare different years.

I also would like to see what the (accumulated) sum of the payments
is at the end of a given week, month.
>Timestamp each transaction, then use a GRUP BY clause to aggregate the
>numbers however you wish. If the available date field extractions are
>not sufficient, write a scalar function of your own to accomplish what
>you need.
>>

No. 1# | By Developer Tags User at [2008-5-5] | size: 992 bytes

Thank you very much.

Sorry to be unclear, they are time stamped, and I wondered if someone
could give me ssome advise how I do this aggregation. In particular do
I not know how to write such a scalar function.

Anything re-usable lying around as examples somewhere?

el

on 10/4/06 9:46 PM Guy Rouillier said the following:
Eberhard Lisse wrote:
>I receive payments, but not every day (or even every week),
>and I would like see how much I receive per week and/or per month. I
>also need to compare different years.
>>

>I also would like to see what the (accumulated) sum of the payments
>is at the end of a given week, month.


Timestamp each transaction, then use a GRUP BY clause to aggregate the
numbers however you wish. If the available date field extractions are
not sufficient, write a scalar function of your own to accomplish what
you need.



Databases Hot!

Databases New!


Copyright © 2008 www.emsdn.com • All rights reserved • CMS Theme by www.emsdn.com - 0.219