vendredi 9 octobre 2015

SQLite get average of a range of rows using OFFSET and LIMIT?

I have a table with about 1000 rows. I want to query for the average value on column "Things" from row 0 to row 79.

I do the following:

SELECT AVG("Things") FROM "MyTable" LIMIT 80 OFFSET 0

At first it seemed like it worked, I get a number back.

then I tried to run this query just to test things:

SELECT AVG("Things") FROM "MyTable" LIMIT 80 OFFSET 10 and I get nothing back. Whatever number I put into for the OFFSET I get nothing back unless it use zero (... OFFSET 0)

I am not sure why that is. Any idea?

Aucun commentaire:

Enregistrer un commentaire