回答編集履歴

1

ちょうせい

2021/10/14 09:12

投稿

yambejp
yambejp

スコア116724

test CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  create table tbl (user_id int,d date);
4
4
 
5
+ ```
6
+
7
+ ```SQL
8
+
5
- insert into tbl
9
+ insert into tbl(user_id,d)
6
10
 
7
11
  select 1,'2020-10-01' + interval a day
8
12
 
@@ -19,3 +23,47 @@
19
23
  ) as sub;
20
24
 
21
25
  ```
26
+
27
+
28
+
29
+ # 複数user_id
30
+
31
+ ```SQL
32
+
33
+ insert into tbl(user_id,d)
34
+
35
+ select * from(
36
+
37
+ select 1+ a
38
+
39
+ from (
40
+
41
+ select @a:= 0 AS a
42
+
43
+ union
44
+
45
+ select @a:= @a + 1 from information_schema.columns
46
+
47
+ limit 5 /* 5人分 */
48
+
49
+ ) as sub ) as t1
50
+
51
+ inner join
52
+
53
+ (select '2020-10-01' + interval a day
54
+
55
+ from (
56
+
57
+ select @a:= 0 AS a
58
+
59
+ union
60
+
61
+ select @a:= @a + 1 from information_schema.columns
62
+
63
+ limit 7 /* 7日分 */
64
+
65
+ ) as sub) as t2
66
+
67
+ on 1
68
+
69
+ ```