title: create a mysql query when date is same for some id but time is differ
body: <p>i have one problem while making a query</p>
  
  <pre><code>wellid       dated              drillid
  1        2000-05-01 11:30:00      123  
  1        2000-05-01 11:30:00      124  
  1        2000-05-01 11:35:00      123  
  1        2000-05-01 11:36:00      124           
  </code></pre>
  
  <p>now i want to make a query that return one row when drillid is equal to 123, but there are two dated for drillid 123, so i want only those dated row whose datetime is maximum as compared to other whose drillid is 123 or 124.</p>
  
  <p>suppose i run query for drillid 123 then it must return me</p>
  
  <pre><code>wellid       dated              drillid
  1        2000-05-01 11:35:00      123  
  </code></pre>
  
  <p>but not return me</p>
  
  <pre><code>wellid       dated              drillid
  1        2000-05-01 11:30:00      123  
  </code></pre>