title: SQL. How to obtain unique values from table but only for 1 column?
body: <p>I have a table1 . I sort this table by name, and  by time column :</p>
  <pre><code>SELECT name, value 
  FROM table1
  WHERE time &gt;= '2022-05-23 00:00:00' AND time &lt;= '2022-05-23 01:00:00'  
  ORDER BY name, time 
  </code></pre>
  <p>AS result i got next table :</p>
  <pre><code>    name,   value,  time
      A,      5,      2022-05-23 01:01:12
      A,      9,      2022-05-23 01:02:11
      A,      7,      2022-05-23 01:03:21
      B,      5,      2022-05-23 01:04:23
      B,      6,      2022-05-23 01:05:33
      C,      7,      2022-05-23 01:06:30
      C,      8,      2022-05-23 01:07:41
      C,      3,      2022-05-23 01:08:44
      C,      7,      2022-05-23 01:09:50
  </code></pre>
  <p>Then i need select all unique names with lowest time, and got values for this names:</p>
  <p>Result should be like this:</p>
  <pre><code>name,   value,  time
  A,      5,      2022-05-23 01:01:12
  B,      5,      2022-05-23 01:04:23
  C,      7,      2022-05-23 01:06:30
  </code></pre>
  <p>=====================================================================</p>
  <p>It turns out that we just took each first unique name from the table:</p>
  <pre><code>name,   value,  time
  A,      5,      2022-05-23 01:01:12 &lt;- take this one
  A,      9,      2022-05-23 01:02:11
  A,      7,      2022-05-23 01:03:21 
  B,      5,      2022-05-23 01:04:23 &lt;- take this one
  B,      6,      2022-05-23 01:05:33
  C,      7,      2022-05-23 01:06:30 &lt;- take this one
  C,      8,      2022-05-23 01:07:41
  C,      3,      2022-05-23 01:08:44
  C,      7,      2022-05-23 01:09:50
  </code></pre>
  <p>My goal is take unique names with lowest timestamp (or each first unique name from table, because it's already sorted by timestamp)</p>
  <p>I'm not clear how to get wanted result.
  I tried use &quot;SELECT DISTINCT name,values&quot; but it's back all unique names AND unique values, but i'm need got ONLY unique names+values (where time is lowest)</p>