MySQL Forums
Forum List  »  Newbie

Re: Average 16 rows back?
Posted by: Peter Brawley
Date: October 23, 2016 09:46AM

> I would like to average the last 16 rows

The "last" in order of date & time? That would be ...

select avg(wh) from (select wh from tbl order by date,time desc limit 16);

But it sounds as if you need running averages, eg see "Group data by datetime periods" at http://www.artfulsoftware.com/infotree/queries.php

> wh are pending all between 120 to over 500 mostly between 150 and 200

You mean trending?

Options: ReplyQuote


Subject
Written By
Posted
October 23, 2016 08:09AM
October 23, 2016 09:10AM
Re: Average 16 rows back?
October 23, 2016 09:46AM
October 24, 2016 02:57AM
October 24, 2016 10:30AM
October 25, 2016 02:30AM
October 25, 2016 06:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.