title: Google BigQuery - Get unique rows based on one column
body: <p>Have this BigQuery</p>
  
  <pre><code>select JSON_EXTRACT_SCALAR(payload, "$.pull_request.base.repo.clone_url") AS clone_url, JSON_EXTRACT_SCALAR(payload, "$.pull_request.base.repo.language") AS language, integer(JSON_EXTRACT_SCALAR(payload, "$.pull_request.base.repo.stargazers_count")) as stars from githubarchive:day.20200115 where  JSON_EXTRACT_SCALAR(payload, "$.pull_request.base.repo.language")="C" group by language,clone_url,stars order by stars DESC limit 1000;
  </code></pre>
  
  <p>It return several entries for "clone_url" with unique "stars".</p>
  
  <p>How do can I show only highest starcount unique for clone_url?</p>
  
  <p>Can this query be optimized?</p>
  
  <p>Below are query results:</p>
  
  <p><a href="https://i.stack.imgur.com/GL5Kh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GL5Kh.png" alt="enter image description here"></a></p>
  
  <p>Thanks,</p>