title: SQL select only one item which meets condition
body: <p>I have a very narrow table: DATA, ID, LAT, LNG, TIME.
  (<a href="https://gyazo.com/52b268c00963ed12ba85c6765f40bf63" rel="nofollow noreferrer">https://gyazo.com/52b268c00963ed12ba85c6765f40bf63</a>)</p>
  
  <p>And I want to select the newest data for each different ID. I was using query like </p>
  
  <pre><code>SELECT * 
    FROM name_of_table 
   WHERE TIME &gt; my_given_time;
  </code></pre>
  
  <p>but it selects TOTALLY all datas and not only data for each different id which meets the condition.</p>
  
  <p>Could somebody please help me write the query?</p>
  
  <p>Thank you for any help. :) </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The final look of my working query looks like:</p>
  
  <pre><code>SELECT * FROM (SELECT * FROM (SELECT ROW_NUMBER() OVER (PARTITION BY ID ORDER BY TIME DESC) AS ROWNUMBER, * FROM my_table) WHERE ROWNUMBER = 1) WHERE TIME &gt; my_time;
  </code></pre>
  
  <p>Thanks everyone for help </p>