質問するログイン新規登録

回答編集履歴

1

調整

2025/02/26 05:18

投稿

yambejp
yambejp

スコア118300

answer CHANGED
@@ -16,4 +16,32 @@
16
16
  ) as t1,JSON_TABLE(val, '$[*]' COLUMNS (value INT PATH '$')) AS j
17
17
  ) as t2
18
18
  group by collection_time
19
+ ```
20
+
21
+ # 調整版
22
+ 各データごとに平均を出して、そのデータを平均する
23
+ ```sql
24
+ select collection_time,
25
+ min(min) as min,
26
+ max(max) as max,
27
+ avg(avg) as avg
28
+ from(
29
+ select collection_time,mac,
30
+ min(value) as min,
31
+ max(value) as max,
32
+ avg(value) as avg
33
+ from (
34
+ select collection_time,mac,value
35
+ from
36
+ (
37
+ select
38
+ collection_time,mac,
39
+ replace(group_concat(JSON_EXTRACT(mv,'$.*')),'],[',',') as val
40
+ from logs
41
+ group by collection_time,mac
42
+ ) as t1,JSON_TABLE(val, '$[*]' COLUMNS (value INT PATH '$')) AS j
43
+ ) as t2
44
+ group by collection_time,mac
45
+ ) as t3
46
+ group by collection_time
19
47
  ```