Repeat lines in Array: is it possible with UNNEST? or is there any other way? - Bigquery

Asked

Viewed 42 times

0

I made this query in SQL in Bigquery (Google):

SELECT
    FORMAT_DATE("%E4Y-%m", date) AS Mes,
    cliente,
    ARRAY_AGG( DISTINCT date ORDER BY date DESC LIMIT 2) AS date
FROM `iconic-rampart-279113.ranktank.IA_InternAll`
    GROUP BY Mes, cliente
    ORDER BY Mes, cliente ASC

It provides the last two dates of a month, that some customer has data, but would like to know how to fill in the blank values of the image.

enter image Description here

inserir a descrição da imagem aqui

Researching I found some queries with UNNEST but I did not understand, let alone know how to reproduce.

Or is there any other way to bring the data? (Month, client, date)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.