Trying to a result set that has up to one row per Sensorrule row where Sensorrule.sensorid exists in Sensordata.sensorid with the DATE(Sensor.messagedate) = CURDATE() and the TIME(Sensordata.messagedate) => Sensorrule.fromtime and TIME(Sensordata.messagedate) => Sensorrule.totime.
Resulting set could be less than number of rows in Sensorrule if there are no rows in Sensordata with the current date (messagedate) with the time of messagedate between fromtime and totime.
Sensorrule
+-------------+--------------+------------+-------+--------------+
| sensorid    | fromtime     | totime     | msg   | name         |
+-------------+--------------+------------+-------+--------------+
| 27460       | 5:00         | 11:00      | Work  | Bob          |
| 27461       | 4:00         | 15:00      | Not   | Susan        |
| 27460       | 7:30         | 12:00      | Max   | Rick         |
+-------------+--------------+------------+-------+--------------|
Sensordata
+---------+---------------------+---------------+----------+
| Room    | messagedate         | transactionid |  sensorid|
+---------+---------------------+---------------+----------+
| Bedroom | 2014-05-30 07:48:14 | 332243181     | 27460    |
| Bedroom | 2014-05-30 05:48:14 | 332243182     | 27464    |
| Bedroom | 2014-05-22 07:36:21 | 332243183     | 27460    |
| Bedroom | 2014-05-22 09:23:21 | 332656534     | 27464    |
| Bedroom | 2014-05-21 06:34:22 | 332243185     | 27461    |
| Bedroom | 2014-05-20 06:15:06 | 332243187     | 27460    |
| Bedroom | 2014-05-20 07:40:34 | 332243172     | 27465    |
| Bedroom | 2014-05-19 09:27:56 | 332243191     | 27461    |
| Bedroom | 2014-05-18 06:34:08 | 332243101     | 27460    |
+---------+---------------------+---------------+----------+
Would like the resulting set to look something like:
Sensorid    msg     name    
24760       Work    Bob 
27461       Not     Susan
Note: Data set above doesn't specifically yield the above result
 
     
    