Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nykoz-0004BE-R3 for pgsql-sql@arkaria.postgresql.org; Wed, 08 Jun 2022 01:49:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nykoy-0001du-Ku for pgsql-sql@arkaria.postgresql.org; Wed, 08 Jun 2022 01:49:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nykoy-0001dl-Bx for pgsql-sql@lists.postgresql.org; Wed, 08 Jun 2022 01:49:20 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nykow-00009V-7j for pgsql-sql@lists.postgresql.org; Wed, 08 Jun 2022 01:49:19 +0000 Received: by mail-wm1-x335.google.com with SMTP id e5so3328187wma.0 for ; Tue, 07 Jun 2022 18:49:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to; bh=HarmbkYsX9t0urQAUYLaEhXke5sUmT0ImibxhmXT6cA=; b=c2oqkMb6fp809obyFFpSwz5hmyxc+Glo70u/cbGXkYyYjEEgAaZcC5QZUXAvhGUwDA d+OydV6Ae1zqsgq2WiZO3v/v8wu8slHqwL0wCCgXy8cMibFanOf1Uw1oM7S8HXSc6d2h YC2FDXLPrw2VN1ogsPlBnOl+xg1d1vDaMOuOvDecSkKWr6fDPWyqQWYbPrM/aq0ggkXx txYvHCWSg2V7DgL3etyaOzIz2rUaPuCLcZ2+yLP0k2hGPnEuX8NrMhBv7T0fCjOH23y3 3GEen48ZrhCX148fthktQ/beUICu/qLPqEd6gUpi5LVzP34u+V6x/gRx0lrneVZpBJ3j kHSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to; bh=HarmbkYsX9t0urQAUYLaEhXke5sUmT0ImibxhmXT6cA=; b=PuJPvTX6BB5vsTmLrd3X2+XKoZEn9arGkszSSmC97W5exrbSWkUZ87RhOrITA5pJD8 Y4XDvynG2+VF3YreGrvGyOt4K3rX9bfPIJzATVUPrpmr1gaeHAC1M7zOg8lBre2qm7JB kCGgl15mG+hPVC78h5KGB5dApTic1AdRpp5mO2rT3ZH1v9ioqz7YDUTKuOAuPE6/ix6s 94YVDhVKErcxPJ9IGU+N0Guhjqjjn6ay6B4rgWO7qbPX/JrR9LQE4/BzCoODqUfqnWW4 cfa8rHVOIwjMGY55ooWIdm2ZKQ4+FZPfWjxHyC2qXuGmFBGBMKKzxlUr162EV5uyJbOQ kbzQ== X-Gm-Message-State: AOAM530maABT8BxgbLzGIYRSe+RlrLspk51up1l+papAvDfYABKiNk+S zibrqvmwnFwzngzFxfff5WdobifPiHHqs4GCQACZbXpq X-Google-Smtp-Source: ABdhPJxzZ8PFLAGDPb7+LLUz7wo7v6TW4ZTxR9WFZnqFephA5NtxWQ+Q50fLgCBtM9dsrgizj3hEhw3qaawYMDtTl5g= X-Received: by 2002:a05:600c:3d05:b0:398:a78b:6a30 with SMTP id bh5-20020a05600c3d0500b00398a78b6a30mr32103506wmb.175.1654652956727; Tue, 07 Jun 2022 18:49:16 -0700 (PDT) MIME-Version: 1.0 References: <4F6F634F-7729-4541-B66A-97D34CA839EA@excoventures.com> In-Reply-To: Reply-To: stercor@gmail.com From: "Theodore M Rolle, Jr." Date: Tue, 7 Jun 2022 21:48:59 -0400 Message-ID: Subject: Fwd: Electricity bill To: pgsql-sql Content-Type: multipart/alternative; boundary="000000000000b65d8005e0e5e9d5" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000b65d8005e0e5e9d5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Will this compute the interval in days? ---------- Forwarded message --------- From: Theodore M Rolle, Jr. Date: Tue, Jun 7, 2022, 21:46 Subject: Re: Electricity bill To: Jonathan Katz 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 wrote: > > > On Jun 7, 2022, at 9:39 PM, Theodore M Rolle, Jr. > 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=E2=80=99 usage? This= requires > retrieving two rows to compute the number of days=E2=80=A6 > > Based on your description, what I can offer right now is: > > SELECT date_trunc(=E2=80=98month=E2=80=99, date_col), sum(val_col= ); > > Jonathan --000000000000b65d8005e0e5e9d5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Will this compute the interval in days?

---------- Forward= ed message ---------
From: Theodore M Rolle, Jr. <stercor@gmail.com>
Date: Tue, Jun 7, 20= 22, 21:46
Subject: Re: Electricity bill
To: Jonathan Katz <jonathan.katz@excoventures.com>


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


> On Jun 7, 2022, at 9:39 PM, Theodore M Rolle, Jr. <sterco= r@gmail.com> wrote:
>
> I'm putting in YYYY-MM-DD dates of electricity bills and would lik= e to not have starting and ending dates in the same row. Only ending date.<= br> > Will someone show me the SQL to compute the months=E2=80=99 usage? Thi= s requires retrieving two rows to compute the number of days=E2=80=A6

Based on your description, what I can offer right now is:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 SELECT date_trunc(=E2=80=98month=E2=80=99, date= _col), sum(val_col);

Jonathan
--000000000000b65d8005e0e5e9d5--