All Questions
2 questions
0
votes
1
answer
2k
views
Calculating Average Value of JSONB array in Postgres
I have a column called "value" in my "answers" table.
| value |
|---------|
| [1,2] |
| [1] |
| [1,2,3] |
The type of "value" is "jsonb".
I want to get ...
0
votes
1
answer
7k
views
Looping through string, adding all numbers e.g. '123' = 1+2+3, demo with working loop included
This works to output the string 123456 as:
1
2
3
4
5
6
Code:
declare @string varchar(20)
declare @index int
declare @len int
declare @char char(1)
set @string = '123456'
set @index = 1
set @len= ...