I have a Google BigQuery table that looks like this:
║ id ║ col_1 ║ col_2 ║ updated ║
║ 1 ║ first_data ║ null ║ 4/22 ║
║ 1 ║ null ║ old ║ 4/23 ║
║ 1 ║ null ║ correct ║ 4/24 ║
I would like to construct a query that combines these rows and "overwrites" null columns if there is a row with the same id with the column not null. Essentially the result should look like:
║ 1 ║ first_data ║ correct ║ 4/24 ║
If possible I would also like the result to represent a history:
║ 1 ║ first_data ║ old ║ 4/23 ║
║ 1 ║ first_data ║ correct ║ 4/24 ║
But that is secondary and not necessary.