Skip to content

Instantly share code, notes, and snippets.

@tejpaldev
Created March 31, 2020 18:29
Show Gist options
  • Save tejpaldev/143db88ae543f7c373654a92a48a509a to your computer and use it in GitHub Desktop.
Save tejpaldev/143db88ae543f7c373654a92a48a509a to your computer and use it in GitHub Desktop.
select f.*,
count(*) over (
partition by title, uk_release_date
) ct
from films f;
select *
from (
select f.*,
count(*) over (
partition by title, uk_release_date
) ct
from films f
)
where ct > 1
Or you could use the with clause:
with film_counts as (
select f.*, count(*) over (partition by title, uk_release_date) ct
from films f
)
select *
from film_counts
where ct > 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment