title: Mysql query select every user per date latest record
body: <p>I am working on large amount of data.I want to select every user per date latest record . 
  My table is given below:</p>
  
  <pre><code> +---+--------+-----+--------+------+-----+
   |id |user_id |name |date    |time1 |time2|
   +---+--------+-----+--------+------+-----+
   |1  |1       |x    |12-1-15 |10:30 |21:30|
   |2  |1       |x    |12-1-15 |10:30 |21:30|
   |3  |2       |y    |12-1-15 |10:30 |22:30|
   |4  |1       |x    |13-1-15 |10:30 |18:30|
   |5  |2       |y    |13-1-15 |10:30 |18:30|
   |6  |2       |y    |13-1-15 |10:30 |20:30|
   +---+--------+-----+--------+------+-----+
  </code></pre>
  
  <p>My output will be:</p>
  
  <pre><code> +---+--------+-----+--------+------+-----+
   |id |user_id |name |date    |time1 |time2|
   +---+--------+-----+--------+------+-----+
   |2  |1       |x    |12-1-15 |10:30 |21:30|
   |3  |2       |y    |12-1-15 |10:30 |22:30|
   |4  |1       |x    |13-1-15 |10:30 |18:30|
   |6  |2       |y    |13-1-15 |10:30 |20:30|
   +---+--------+-----+--------+------+-----+
  
  SELECT * FROM user
  Where Date In (Select Max(Date) from user 
  Group by user_id,Date)
  </code></pre>