How to get the average value of each second? MySQL I wonder how to output the average data of each second.
My data set is in millisecond and I can out them in millisecond by

SELECT * FROM some_table 
where RealTime &gt; '2019-09-10 23:00:00' LIMIT 200;


Below is the Data Format

AcX       RealTime
-15836   2019-09-05 15:02:37.502
-16666   2019-09-05 15:02:37.508
-17645   2019-09-05 15:02:37.512
...


But how can I get the average data in each second? Thx
SELECT  LEFT(RealTime, 19) AS to_the_second,
        ROUND(AVG(AcX))  AS Average_AcX
    FROM some_table
    GROUP BY 1;


Notes:


Often it is practical to treat a datetime (or timestamp) as a string, as I am doing with the LEFT.
You may want to add the number of decimal places to the ROUND() function call.
The 1 in GROUP BY 1 is shorthand for 1st column (the LEFT...).