質問編集履歴
1
質問編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,15 +2,23 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
SELECT name,code,testid,message,time FROM testdb.testtable1
|
5
|
+
SELECT t1.name,t1.code,t2.testid,t2.message,t2.time FROM testdb.testtable1 t1
|
6
6
|
|
7
|
-
INNER JOIN testdb.testtable2
|
7
|
+
INNER JOIN testdb.testtable2 t2
|
8
8
|
|
9
|
-
ON t
|
9
|
+
ON t1.id = t2.testid
|
10
10
|
|
11
11
|
and message like '%error%'
|
12
12
|
|
13
13
|
;
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
[テーブルの中に入っているもの]
|
18
|
+
|
19
|
+
testtable1 : name,code
|
20
|
+
|
21
|
+
testtable2 : testid,name,time
|
14
22
|
|
15
23
|
|
16
24
|
|
@@ -20,17 +28,17 @@
|
|
20
28
|
|
21
29
|
|
22
30
|
|
23
|
-
SELECT name,code,testid,message,time FROM testdb.testtable1
|
31
|
+
SELECT t1.name,t1.code,t2.testid,t2.message,t2.time FROM testdb.testtable1 t1
|
24
32
|
|
25
33
|
INNER JOIN testdb.testtable2
|
26
34
|
|
27
|
-
ON t
|
35
|
+
ON t1.id = t2.testid
|
28
36
|
|
29
37
|
and message like '%error%'
|
30
38
|
|
31
|
-
where (testid,time) in (select max(time) from testdb.t
|
39
|
+
where (t2.testid,t2.time) in (select max(t2.time) from testdb.t2.
|
32
40
|
|
33
|
-
group by testid);
|
41
|
+
group by t2.testid);
|
34
42
|
|
35
43
|
|
36
44
|
|