r/DatabaseHelp • • Apr 19 '16

Average of every N rows, with SQLite?

Lets say for table:

Col1Col2
4Bar
2Foo
6Baz
9Banana
10FooBar
5Apple

It would return

Col1(This is math, not actual return)
3(4+2)/2
7.5(6+9)/2
7.5(10+5)/2

I can do this with backend code w/o problems, but letting SQ do most if data-related work, is better idea, right?

2 Upvotes

9 comments sorted by

View all comments

Show parent comment

1

u/MRoka5 Apr 19 '16

For loop, with +n increment.

No, sadly they dont have unique values / group. :/