Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading