title: MSQL select one of each
body: <p>i have a table like this...</p>
  
  <pre><code>username     action   time
  user1        login    00.00.00
  user1        logout   01.00.00
  user2        login    02.00.00
  </code></pre>
  
  <p>i want to select last action of each username on 02.00.00 so it must be like this..</p>
  
  <pre><code>user1 logout
  user2 login
  </code></pre>
  
  <p>I have tried this but looks like doesnt complete yet.</p>
  
  <pre><code>select (distinct username), action from log where date(time) &lt;= '02.00.00'
  </code></pre>
  
  <p>Thankyou in advance.</p>