Re: sum of numeric column

From: avi Singh <avisingh19811981(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: sum of numeric column
Date: 2020-12-10 03:35:26
Message-ID: CAETvN5hgVj43z7FMosBMaricTA2LX852V87ytp-oxTFcYiPRNA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Adrian for pointing me in the right direction, i got it working

On Wed, Dec 9, 2020 at 5:32 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 12/9/20 5:04 PM, avi Singh wrote:
> > Thanks for your reply Adrian
> >
> >
> > What do you want to do with the array?
> > i want to do a sum of the values of numeric array type column e.g. below
> > data_numeric
> > --------------
> > {2.0}
> > {1.0}
>
> If you are going to have a single element arrays only then why not just
> use a numeric field?
>
> To answer question:
>
> select sum(data_numeric[1]) from some_table;
>
> If you are going to have multi-element arrays then there are more
> questions:
>
> 1) Do you want sum horizontal in array?
>
> 2) If 1) then also vertical in column?
>
> 3) Do you want sum in 'columns' of arrays?
>
> 4) If 3) then what about missing data?
>
> >
> >
> > (4 rows)
> >
> >
> >
> > Regards
> >
> >
>
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lars Vonk 2020-12-10 08:12:32 Re: Performance penalty during logical postgres replication
Previous Message Adrian Klaver 2020-12-10 01:32:46 Re: sum of numeric column