我已经做了一些搜索类似的问题,但没有运气。 下面的样本表。
ID | MO | Serial | PiID | Part_Number | Timestamp
1 | F610320 | 1 | QC1 | 4A130015 | 2017-05-10 09:55:28
2 | F610320 | 2 | QC1 | 4A130015 | 2017-05-10 10:12:54
3 | F610320 | 3 | QC1 | 4A130015 | 2017-05-10 10:19:47
4 | F631323 | 1 | QC2 | 4A110007B | 2017-05-10 10:20:24
5 | F631323 | 2 | QC2 | 4A110007B | 2017-05-10 10:21:50
6 | F631323 | 3 | QC3 | 4A110007B | 2017-05-10 10:31:02
7 | F631323 | 4 | QC3 | 4A110007B | 2017-05-10 10:31:02
并在命令之后 SELECT A. *,COUNT(A.MO)FROM datalog A GROUP BY A.MO,A.PiID
我想要一个平均时间的列。 (不同的MO
和PiID
)
| MO | PiID | Part_Number |COUNT(MO)| average time
| F610320 | QC1 | 4A130015 | 3 | (10:19:47 - 09:55:28)/3-1
| F631323 | QC2 | 4A110007B | 2 |avg time between row by MO and PiID
| F631323 | QC3 | 4A110007B | 2 |avg time between row by MO and PiID
感谢您的帮助!