Skip to content

Instantly share code, notes, and snippets.

Created December 26, 2013 12:20
Show Gist options
  • Save anonymous/8133108 to your computer and use it in GitHub Desktop.
Save anonymous/8133108 to your computer and use it in GitHub Desktop.
with v as (
select * from (
select
id, hoge, huga,
row_number() over(partition by hoge, fufa order by id) as rownum
from T
) vv
where
vv.rownum > 1
)
select * from T a
where
a.id not in (
select vv.id from vv
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment