且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 BigQuery 表中删除重复行

更新时间:2023-02-02 20:52:33

您可以通过运行重写您的表的查询来删除重复项(您可以使用与目标相同的表,或者您可以创建一个新表,验证它有你想要的,然后复制到旧表上).

You can remove duplicates by running a query that rewrites your table (you can use the same table as the destination, or you can create a new table, verify that it has what you want, and then copy it over the old table).

一个应该有效的查询在这里:

A query that should work is here:

SELECT *
FROM (
  SELECT
      *,
      ROW_NUMBER()
          OVER (PARTITION BY Fixed_Accident_Index)
          row_number
  FROM Accidents.CleanedFilledCombined
)
WHERE row_number = 1