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

質問編集履歴

20

2020/04/01 08:45

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

19

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

18

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

17

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

16

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

15

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

14

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

13

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

12

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

11

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

10

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

9

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

8

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

7

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

6

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

5

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

4

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
@@ -1,1 +1,1 @@
1
- SQLSERVER 外部結合で縦のデータを横に並べて文字連結をする。
1
+ うかかなゆかはらやや
body CHANGED
File without changes

3

2020/04/01 08:44

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

2

2020/04/01 08:43

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
File without changes

1

2020/04/01 08:43

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,55 +1,21 @@
1
1
  ```ここに言語を入力
2
- select
3
- ROW_NUMBER()OVER(ORDER BY a.ID) as ID
4
- ,姓
5
- ,名
6
- ,性別
2
+ コード
7
- ,TA.住所+TB.住所+TC.住所 as 住所
3
+ ```### ```~~````````````````````````ここに言語を入力
4
+ ここに言語を入力
8
- ,年齢
5
+ ```
9
- ,ID2
6
+ ここに言語を入力
10
- ,趣味
7
+ ```
11
- from (select
8
+ ここに言語を入力
12
- ID
13
- ,姓
14
- ,名
15
- ,性別
9
+ ```
10
+ ここに言語を入力
16
- ,住所
11
+ ```
12
+ ここに言語を入力
17
- ,年齢
13
+ ```
18
- ,ID2
14
+ ここに言語を入力
19
- ,趣味
15
+ ```
20
- from K3_Sheet1
21
- where ID2 is not null
22
- ) as TA
23
- full join
16
+ ここに言語を入力
24
- (select
25
- ID
26
- ,住所
17
+ ```
27
- from K3_Sheet1
18
+ ここに言語を入力
28
- where ID2=2 or ID=15
29
- ) as b
19
+ ```~~
30
- on TA.ID=TB.ID-1
31
- full join
20
+ ヘディングのテキスト
32
- (select
33
- ID
34
- ,住所
21
+ ```
35
- from K3_Sheet1
36
- where ID2=3 or ID=12 or ID=16
37
- ) as c
38
- on TA.ID=TC.ID-2
39
- ```### 前提・実現したいこと
40
- sqlserver2008で
41
- 後でデータを追加しても二つ目の図のように表示できるようにしたいです。
42
- インサートやアップデートは禁止です。
43
- 外部結合でなるべく表示してほしいと指示があったので
44
- 文を作ってみましたがデータが増えた時にこのコードだと書き換えないとだめだと却下されました。
45
- ヒントを頂いてもよろしいでしょうか?
46
-
47
- ### このExcelの表を
48
- ![イメージ説明](ac83c051272e52310af4ccfa0fa1016f.png)
49
- ### 下の図のように出力したい
50
- ![イメージ説明](adc16fdd759b5c242ddf90d1969c2e64.png)
51
-
52
-
53
-
54
- ### 補足情報(FW/ツールのバージョンなど)
55
- SQLserver 8を使用しています