$datetime_show1= $f001_operate_hour_start.":".$f001_operate_min_start.":00"; $datetime_show2=$f001_operate_hour_end.":".$f001_operate_min_end.":59";
$sql = "SELECT MAX(auto_number) AS auto_number, factory_id, factory_name, line_id, weight_count, r_color, g_color, b_color, MAX(date) AS date ,MAX(time) AS time , MAX(count) AS count , MAX(weight) AS weight FROM db2 WHERE ";
$sql=$sql." date >= '".$date_start_select."' and date <='".$date_end_select."'";
$sql=$sql." and time >= '".$datetime_show1."' and time <='".$datetime_show2."'";
$sql=$sql. " GROUP BY date " ;