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 01:04:22 |
Message-ID: | CAETvN5h4LsUR6=pGNdmA8xpzPX0nKc3A7xJfCEaq-nGO-YPN7A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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}
(4 rows)
Regards
On Wed, Dec 9, 2020 at 4:49 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:
> On 12/9/20 4:46 PM, avi Singh wrote:
> > I have a table structure and want to do a sum of column type i.e
> > numeric. How can I do it ? when i try sum function i get this error
>
> You don't have a numeric type you have a numeric array type.
>
> >
> > ERROR: function sum(numeric[]) does not exist
>
> Hence the error above.
>
> >
> > Can anyone please help me with this ?
>
> What do you want to do with the array?
>
> >
> > Column | Type | Collation |
> > Nullable | Default
> >
> ----------------------------+--------------------------+-----------+----------+---------
> > grid_id | bigint | |
> > not null |
> > as_of_date | date | |
> > not null |
> > cell_id | bigint | |
> > not null |
> > last_event_timestamp_local | timestamp with time zone | |
> > |
> > last_event_id | bigint | |
> > |
> > column_id | bigint | |
> > |
> > column_name | character varying(50) | |
> > |
> > row_id | bigint | |
> > |
> > data_type_id | smallint | |
> > |
> > data_numeric | numeric[] | |
> > |
> > data_string | character varying[] | |
> > |
> >
> > e.g. of values in numeric type column
> >
> > data_numeric
> > --------------
> > {2.0}
> > {1.0}
> >
> > Regards
> > Prabhjot
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2020-12-10 01:32:46 | Re: sum of numeric column |
Previous Message | Adrian Klaver | 2020-12-10 00:48:52 | Re: sum of numeric column |