title: Selecting the last entry of each day in a timestamp and corresponding values
body: <p>I have a table called 'admin_tmp' with following structure</p>
  
  <pre><code>Field                 | Type             | Null | Key | Default | Extra
  ----------------------+------------------+------+-----+---------+---------------
  id                    | int(10) unsigned | NO   | PRI | NULL    | auto_increment
  time_stamp            | varchar(30)      | NO   |     | NULL    |
  curr_property         | int(5) unsigned  | NO   |     | NULL    |
  curr_property_cost    | int(5) unsigned  | NO   |     | NULL    |
  day_property          | int(S) unsigned  | NO   |     | NULL    |
  day_property_cost     | int(5) unsigned  | NO   |     | NULL    |
  curr_solar_generating | int(5) unsigned  | NO   |     | NULL    |
  curr_solar_export     | int(5) unsigned  | NO   |     | NULL    |
  day_solar_generated   | int(5) unsigned  | NO   |     | NULL    |
  day_solar_export      | int(5) unsigned  | NO   |     | NULL    |
  curr_chanl            | int(5) unsigned  | NO   |     | NULL    |
  curr_chan2            | int(5) unsigned  | NO   |     | NULL    |
  curr_chan3            | int(5) unsigned  | NO   |     | NULL    |
  day chan1             | int(5) unsigned  | NO   |     | NULL    |
  day_chan2             | int(5) unsigned  | NO   |     | NULL    |
  day_chan3             | int(5) unsigned  | NO   |     | NULL    |
  </code></pre>
  
  <p>Now I want to select last entry between two time values 7:0:0 and 7:59:59  (only date not the timestamp) for each day and its corresponding values </p>
  
  <p>I am able to fetch only the follow using the below query,</p>
  
  <p><strong>Query</strong></p>
  
  <pre><code>SELECT id, time_stamp , curr_property, day_property, mytime , mydate 
  FROM (
  SELECT 
  *
  ,DATE(time_stamp) AS mydate
  ,TIME(time_stamp) AS mytime
  FROM admin_tmp
  ) AS Result
  WHERE mytime &gt;= '07:00:00' AND mytime &lt;= '07:59:59'
  Order By mytime LIMIT 15;
  </code></pre>
  
  <p><strong>Result</strong></p>
  
  <pre><code>   id | time_stamp          | curr_property | day_property | mytime   | mydate    
  ------+---------------------+---------------+--------------+----------+-----------
   1225 | 2014-06-01 07:00:04 |          1641 |        11466 | 07:00:04 | 2014-06-01
  13802 | 2014-06-03 07:00:05 |          1850 |        15452 | 07:00:05 | 2014-06-03
   7418 | 2014-06-02 07:00:05 |          1577 |        13053 | 07:00:05 | 2014-06-02
   1226 | 2014-06-01 07:00:16 |          1593 |        11471 | 07:00:16 | 2014-06-01
  13803 | 2014-06-03 07:00:17 |          1577 |        15457 | 07:00:17 | 2014-06-03
   7419 | 2014-06-02 07:00:17 |          1528 |        13058 | 07:00:17 | 2014-06-02
   1227 | 2014-06-01 07:00:28 |          1577 |        11476 | 07:00:28 | 2014-06-01
   7420 | 2014-06-02 07:00:29 |          1545 |        13063 | 07:00:29 | 2014-06-02
  13804 | 2014-06-03 07:00:29 |          1850 |        15464 | 07:00:29 | 2014-06-03
   1228 | 2014-06-01 07:00:40 |           981 |        11480 | 07:00:40 | 2014-06-01
  13805 | 2014-06-03 07:00:41 |          1561 |        15469 | 07:00:41 | 2014-06-03
   7421 | 2014-06-02 07:00:41 |          1577 |        13069 | 07:00:41 | 2014-06-02
   1229 | 2014-06-01 07:00:52 |          1206 |        11484 | 07:00:52 | 2014-06-01
   7422 | 2014-06-02 07:00:53 |          1399 |        13073 | 07:00:53 | 2014-06-02
  13806 | 2014-06-03 07:00:53 |          1545 |        15474 | 07:00:53 | 2014-06-02
  </code></pre>
  
  <p>I came to know that I have to use join to achieve this, but again I couldn't use join without any errors. </p>