teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

訂正

2018/07/11 06:24

投稿

ttyp03
ttyp03

スコア17002

answer CHANGED
@@ -1,8 +1,19 @@
1
1
  こういう感じ?
2
2
  ```SQL
3
3
  SELECT kickoff AS キックオフ日時,
4
- (select IsNull(name, '') from countries where p.my_country_id = id) AS 国名1,
4
+ IsNull((select name from countries where p.my_country_id = id), '') AS 国名1,
5
- (select IsNull(name, '') from countries where p.enemy_country_id = id) AS 国名2
5
+ IsNull((select name from countries where p.enemy_country_id = id), '') AS 国名2
6
6
  FROM pairings p
7
7
  ORDER BY kickoff
8
+ ```
9
+
10
+ LEFT JOIN の置き換えだったらNULLはNULLのままでいいのか。
11
+ だとするとIsNullはいらないか。
12
+
13
+ ```SQL
14
+ SELECT kickoff AS キックオフ日時,
15
+ (select name from countries where p.my_country_id = id) AS 国名1,
16
+ (select name from countries where p.enemy_country_id = id) AS 国名2
17
+ FROM pairings p
18
+ ORDER BY kickoff
8
19
  ```