title: Query for unique record on basis of status
body: <p>I need help in writing the sql query for finding the record on the basis of status. I created a table using this query:</p>
  
  <pre><code>CREATE TABLE inglogs (id int, mobileno int(10), status varchar(10));
  INSERT INTO inglogs (id, mobileno, status)
  VALUES
  (1, 1234, 'fail'),
  (2, 1234, 'fail'),
  (3, 1234, 'success'),
  (4, 2345, 'success'),
  (5, 2345, 'success'),
  (6, 4326, 'fail'),
  (7, 4327, 'success')
  </code></pre>
  
  <p>I want to query from the above table where and get distinct mobileno like <code>1234,2345,4326,4327</code> with its status like if there is any success with that mobileno , it should return that record with id and status, also if there is not any success for any mobile (<code>in my case it is 4326</code>) then that should also be visible in in the executed query.</p>
  
  <p>eg I want some thing like this:</p>
  
  <pre><code>+---+  +--------+  +----------+
  |id |  |mobileno|  |  status  |
  +---+  +--------+  +----------+
  |3  |  |  1234  |  |  success |
  |5  |  |  2345  |  |  success |
  |6  |  |  4326  |  |  fail    |
  |7  |  |  4327  |  |  success |
  +---+  +--------+  +----------+
  </code></pre>