Skip to content
Advertisement

Remove duplicated rows with same Timestamp but different values

I have “duplicated” rows in Bigquery and I need to keep just the last occurrence grouped by id of element.

As you can see, these are not duplicated rows, those are duplicated Timestamps with different values. I need to keep one registry per Timestamp.

I run this query to get the example:

Table with data example:

enter link description here

Advertisement

Answer

In your sample data, the timestamps all look the same. Assuming they are really different, you can use qualify:

If you want to actually delete rows (and I would instead suggest putting the data into a new table), you could do:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement