Re: Electricity bill

Поиск
Список
Период
Сортировка
От Jonathan Katz
Тема Re: Electricity bill
Дата
Msg-id 4F6F634F-7729-4541-B66A-97D34CA839EA@excoventures.com
обсуждение исходный текст
Ответ на Electricity bill  ("Theodore M Rolle, Jr." <stercor@gmail.com>)
Список pgsql-sql
> On Jun 7, 2022, at 9:39 PM, Theodore M Rolle, Jr. <stercor@gmail.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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Theodore M Rolle, Jr."
Дата:
Сообщение: Electricity bill
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Electricity bill