回答編集履歴
1
コメントを受けての追記
test
CHANGED
@@ -19,3 +19,31 @@
|
|
19
19
|
```
|
20
20
|
|
21
21
|
速度が欲しいならストアドでゴリゴリかな?
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
コメントを受けての追記
|
26
|
+
|
27
|
+
```SQL
|
28
|
+
|
29
|
+
SELECT dt.*,
|
30
|
+
|
31
|
+
(
|
32
|
+
|
33
|
+
SELECT TOP(1) st.status1
|
34
|
+
|
35
|
+
FROM Settings AS st
|
36
|
+
|
37
|
+
WHERE dt.code1 = st.code1
|
38
|
+
|
39
|
+
ORDER BY
|
40
|
+
|
41
|
+
CASE WHEN dt.code2 = st.code2 THEN -2 END
|
42
|
+
|
43
|
+
+ CASE WHEN dt.code3 = st.code3 THEN -3 END
|
44
|
+
|
45
|
+
) AS Setting
|
46
|
+
|
47
|
+
FROM DataTable AS dt
|
48
|
+
|
49
|
+
```
|