回答編集履歴
1
ちょうせい
answer
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
```SQL
|
2
2
|
create table tbl (user_id int,d date);
|
3
|
+
```
|
4
|
+
```SQL
|
3
|
-
insert into tbl
|
5
|
+
insert into tbl(user_id,d)
|
4
6
|
select 1,'2020-10-01' + interval a day
|
5
7
|
from (
|
6
8
|
select @a:= 0 AS a
|
@@ -8,4 +10,26 @@
|
|
8
10
|
select @a:= @a + 1 from information_schema.columns
|
9
11
|
limit 7
|
10
12
|
) as sub;
|
13
|
+
```
|
14
|
+
|
15
|
+
# 複数user_id
|
16
|
+
```SQL
|
17
|
+
insert into tbl(user_id,d)
|
18
|
+
select * from(
|
19
|
+
select 1+ a
|
20
|
+
from (
|
21
|
+
select @a:= 0 AS a
|
22
|
+
union
|
23
|
+
select @a:= @a + 1 from information_schema.columns
|
24
|
+
limit 5 /* 5人分 */
|
25
|
+
) as sub ) as t1
|
26
|
+
inner join
|
27
|
+
(select '2020-10-01' + interval a day
|
28
|
+
from (
|
29
|
+
select @a:= 0 AS a
|
30
|
+
union
|
31
|
+
select @a:= @a + 1 from information_schema.columns
|
32
|
+
limit 7 /* 7日分 */
|
33
|
+
) as sub) as t2
|
34
|
+
on 1
|
11
35
|
```
|