public inbox for [email protected]  
help / color / mirror / Atom feed
From: Theodore M Rolle, Jr. <[email protected]>
To: pgsql-sql <[email protected]>
Subject: Fwd: Electricity bill
Date: Tue, 7 Jun 2022 21:48:59 -0400
Message-ID: <CAPDmd-ANAvT234d-gsMzhSnQJt_ypGY8S6mOLFWpS92_iiTDKw@mail.gmail.com> (raw)
In-Reply-To: <CAPDmd-CLcT1RQvRpD4NjMgpOSCO5mYYs2Bctx_MG5U7jiYdsWA@mail.gmail.com>
References: <CAPDmd-CjfhW5pSkthOGmb1rDpznDWYOetrhVh1gcquwQM9n5eA@mail.gmail.com>
	<[email protected]>
	<CAPDmd-CLcT1RQvRpD4NjMgpOSCO5mYYs2Bctx_MG5U7jiYdsWA@mail.gmail.com>

Will this compute the interval in days?

---------- Forwarded message ---------
From: Theodore M Rolle, Jr. <[email protected]>
Date: Tue, Jun 7, 2022, 21:46
Subject: Re: Electricity bill
To: Jonathan Katz <[email protected]>


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 <[email protected]>
wrote:

>
> > On Jun 7, 2022, at 9:39 PM, Theodore M Rolle, Jr. <[email protected]>
> 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


view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Fwd: Electricity bill
  In-Reply-To: <CAPDmd-ANAvT234d-gsMzhSnQJt_ypGY8S6mOLFWpS92_iiTDKw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox