回答編集履歴

2

訂正

2021/04/15 03:34

投稿

sazi
sazi

スコア25327

test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ```SQL
4
4
 
5
- select *, @n := @n + 1 as no
5
+ select m.*, @n := @n + 1 as no
6
6
 
7
7
  from (
8
8
 
@@ -16,8 +16,6 @@
16
16
 
17
17
  , D.code
18
18
 
19
- , @n
20
-
21
19
  from tableA as A
22
20
 
23
21
  inner join tableB as B on B.id = A.id
@@ -30,12 +28,10 @@
30
28
 
31
29
  inner join tableC as D on D.id = A.id
32
30
 
33
- , (select @n:=0) n
34
-
35
31
  where 1 = 1
36
32
 
37
33
  order by A.code, A.order_no, D.id
38
34
 
39
- )
35
+ ) m, (select @n:=0) n
40
36
 
41
37
  ```

1

訂正

2021/04/15 03:34

投稿

sazi
sazi

スコア25327

test CHANGED
@@ -15,6 +15,8 @@
15
15
  , C.data2
16
16
 
17
17
  , D.code
18
+
19
+ , @n
18
20
 
19
21
  from tableA as A
20
22