Last active
March 16, 2022 16:27
-
-
Save yssymmt/937cd8c1c60f73a282969fac652a594a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with src as ( | |
select | |
製品番号, | |
製品名称 | |
from データベース名.テーブル名 | |
group by 1,2 | |
) | |
, idchk as ( | |
select | |
製品番号 | |
from データベース名.テーブル名 | |
group by 1 | |
having count(*) >1 | |
) | |
, descchk as ( | |
select | |
製品名称 | |
from データベース名.テーブル名 | |
group by 1 | |
having count(*) >1 | |
) | |
select | |
製品番号, | |
製品名称 | |
from src | |
where 製品番号 in ( | |
select 製品番号 from idchk | |
) or 製品名称 in ( | |
select 製品名称 from descchk | |
) | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment