Fwd: Electricity bill

From: "Theodore M Rolle, Jr(dot)" <stercor(at)gmail(dot)com>
To: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Fwd: Electricity bill
Date: 2022-06-08 01:48:59
Message-ID: CAPDmd-ANAvT234d-gsMzhSnQJt_ypGY8S6mOLFWpS92_iiTDKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Will this compute the interval in days?

---------- Forwarded message ---------
From: Theodore M Rolle, Jr. <stercor(at)gmail(dot)com>
Date: Tue, Jun 7, 2022, 21:46
Subject: Re: Electricity bill
To: Jonathan Katz <jonathan(dot)katz(at)excoventures(dot)com>

Will this get the current and the last months' dates to compute the
interval in days?

On Tue, Jun 7, 2022, 21:42 Jonathan Katz <jonathan(dot)katz(at)excoventures(dot)com>
wrote:

>
> > On Jun 7, 2022, at 9:39 PM, Theodore M Rolle, Jr. <stercor(at)gmail(dot)com>
> wrote:
> >
> > I'm putting in YYYY-MM-DD dates of electricity bills and would like to
> not have starting and ending dates in the same row. Only ending date.
> > Will someone show me the SQL to compute the months’ usage? This requires
> retrieving two rows to compute the number of days…
>
> Based on your description, what I can offer right now is:
>
> SELECT date_trunc(‘month’, date_col), sum(val_col);
>
> Jonathan

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2022-06-08 14:15:58 Re: Electricity bill
Previous Message David G. Johnston 2022-06-08 01:47:17 Re: Electricity bill