duplicate data - prayagupa/rdb Wiki

sql

create or replace table `my_table` as
(
        SELECT * FROM (
          base_views_dups AS (
            SELECT 
            cv.placement_id,
            cv.visitor_id
            ROW_NUMBER() OVER (PARTITION BY pv.visitor_id, cv.placement_id ORDER BY pv.visitor_id, cv.placement_id) dup_id
            FROM `placement_views` cv
            JOIN `page_views` pv
            ON cv.visitor_id = pv.visitor_id
          ) SELECT * except(dup_id) FROM base_views_dups WHERE dup_id = 1
        )
)