Re: sum of numeric column

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: sum of numeric column
Дата
Msg-id 86102209-ad3d-fac9-eee9-8f4906fae86c@aklaver.com
обсуждение исходный текст
Ответ на Re: sum of numeric column  (avi Singh <avisingh19811981@gmail.com>)
Ответы Re: sum of numeric column
Список pgsql-general
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.klaver@aklaver.com



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

Предыдущее
От: avi Singh
Дата:
Сообщение: Re: sum of numeric column
Следующее
От: avi Singh
Дата:
Сообщение: Re: sum of numeric column