Skip to content
Advertisement

Select different min dates BigQuery

Input and expected output

I have a table with different values in BigQuery and I want to select the min or the max of these values.

Advertisement

Answer

You can use min/max with group by to get min or max date per ID group

SELECT ID, MIN(DATE) AS MIN_DATE, MAX(DATE) AS MAX_DATE
FROM TABLE
GROUP BY ID 
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement