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

回答編集履歴

2

修正

2019/10/28 05:41

投稿

sazi
sazi

スコア25430

answer CHANGED
@@ -12,7 +12,7 @@
12
12
  select * from tbl t
13
13
  where not exists(
14
14
  select 1 from tbl
15
- where key1 = like substr(t.key1, 1, 2) || '%'
15
+ where key1 like substr(t.key1, 1, 2) || '%'
16
16
  and array[key1, key2, key3]::text[] > array[t.key1, t.key2, t.key3]::text[]
17
17
  )
18
18
  ```

1

訂正

2019/10/28 05:41

投稿

sazi
sazi

スコア25430

answer CHANGED
@@ -12,7 +12,7 @@
12
12
  select * from tbl t
13
13
  where not exists(
14
14
  select 1 from tbl
15
- where substr(key1, 1, 2) = substr(t.key1, 1, 2)
15
+ where key1 = like substr(t.key1, 1, 2) || '%'
16
16
  and array[key1, key2, key3]::text[] > array[t.key1, t.key2, t.key3]::text[]
17
17
  )
18
18
  ```