Answer the question
In order to leave comments, you need to log in
How to calculate the average difference between values in SQL?
The structure of the table is as follows:
It is required to find the average difference between actions in time (timestamp) for each object (file).
For example File1 had 4 activities:
Activity1 at time 1549256689
Activity2 at time 1549655521
Activity3 at time 1550165431
Activity4 at time 1550317858
For example File2 had 2 activities:
Activity1 at time 1548548573
Activity2 at time
1549875732 File2 1327159, total average 973436
How to write a SQL query to find such an average difference?
Answer the question
In order to leave comments, you need to log in
I got a pretty top answer from Stack Overflow, the guys there understood everything without linking to references and sending to a simple avg function, the following came out:
Thanks to everyone who tried to help!
PS in the eighth version there is still a LEAD statement for iterations
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question