title: What is the BigQuery equivalent of PostgreSQL's `DISTINCT ON`?
body: <p>I am migrating some queries from PostgreSQL dialect over to BigQuery. One nice pattern in <a href="https://www.postgresql.org/docs/14/sql-select.html#SQL-DISTINCT" rel="nofollow noreferrer">PostgreSQL is <code>DISTINCT ON (key)</code></a>, which returns the first row for every key based on the sequence as defined in the <code>ORDER BY</code> section.</p>
  <p>Is there a similar pattern I can use in BigQuery that would avoid wrapping the query as a CTE?</p>
  <p>PostgreSQL query:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT
      DISTINCT ON (user_id)
      user_id,
      updated_on,
      net_change
  FROM
      table_name
  ORDER BY
      user_id, updated_on DESC
  </code></pre>