title: Selecting last event given certain conditions
body: <p>In <a href="http://sqlfiddle.com/#!2/87383/5" rel="nofollow">this SQLFiddle</a> you may find the query I'm working on actually. I have a database table which holds events from users which are logging in and out in their telephones.</p>
  
  <p>I have a query which, basically, select an agent only if it's virtually "logged" but within the logging event, you may have other status such as being talking or being in administrative time.</p>
  
  <p>What I want to achieve is to get the LAST status for those agents who are logged.</p>
  
  <p>Please, note that it's not possible to be unlogged and then have another status related to logged status.</p>