Return only the newest rows from a BigQuery table with a duplicate items

前端 未结 2 1560
余生分开走
余生分开走 2020-12-17 01:59

I have a table with many duplicate items – Many rows with the same id, perhaps with the only difference being a requested_at column.

I\'d l

2条回答
  •  旧巷少年郎
    2020-12-17 02:14

    I suggest a similar form that avoids a sort in the window function:

    SELECT *
        FROM (
          SELECT
              *,
              MAX()
                  OVER (PARTITION BY )
                  AS max_timestamp,
          FROM 
        )
        WHERE  = max_timestamp
    
        

    提交回复
    热议问题