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

回答編集履歴

2

修正

2017/08/26 04:25

投稿

sazi
sazi

スコア25430

answer CHANGED
@@ -15,7 +15,7 @@
15
15
  from (
16
16
  select *
17
17
  , case when '組織コード'=any(組織名)
18
- or exists(select 1 from テーブル3 where '組織コード' = テーブル3.組織コード and 会員id=t1.会員id)
18
+ or exists(select 1 from テーブル3 where '組織コード'=組織コード and 会員id=t1.会員id)
19
19
  then '組織名' else 'その他' end as organization
20
20
  from テーブル1 t1
21
21
  ) v1

1

修正

2017/08/26 04:24

投稿

sazi
sazi

スコア25430

answer CHANGED
@@ -14,7 +14,7 @@
14
14
  select count(*), organization
15
15
  from (
16
16
  select *
17
- , case when '組織コード'=any(テーブル1.組織名)
17
+ , case when '組織コード'=any(組織名)
18
18
  or exists(select 1 from テーブル3 where '組織コード' = テーブル3.組織コード and 会員id=t1.会員id)
19
19
  then '組織名' else 'その他' end as organization
20
20
  from テーブル1 t1