Mean() of last 10 entries, instead of time based

Currently getting the mean value of the most recent entries into the DB based on time:

SELECT MEAN(value) FROM “adjust_temp” WHERE time>now() -10m

I’ve been looking but not able to find anything pertaining to this, but is there a way to get the mean() of a certain number of recent entries, regardless of time? basically just looking to average the last 10 values. Time is not helpful, as sometimes, I don’t have entries over a certain time period.

SELECT MEAN(value) FROM “adjust_temp” WHERE last 10 entries

Thanks for any help and points in the right direction++

Hello @butteryak,
You can use the limit clause:

But you need to make sure that you are querying far back enough to get at least 10 points.
There is no way to do this without a timerange.
This type of feature will be coming to InfluxDB next year with the release of InfluxDB IOx.