Mysql 查询指令 1
1 一、查询两个时间字段相减的差值 2 >>> (TIME_TO_SEC(时间字段一) - TIME_TO_SEC(时间字段二))
3 select bl_no, 4 task_result, 5 carrier_code, 6 task_start_time, 7 return_data_time, 8 receive_task_time, 9 task_finish_time, 10 (TIME_TO_SEC(task_finish_time) - TIME_TO_SEC(receive_task_time)) sec 11 from lc_tracking_task_record 12 order by task_finish_time desc;
1 二、时间格式化函数
2 >>> date_format(task_finish_time, '%Y-%m-%d %H:%i')
3 select s.carrier_code,count(*),s.t1
4 from (
5 select *, date_format(receive_task_time, '%Y-%m-%d %H:%i') t1,date_format(task_finish_time, '%Y-%m-%d %H:%i') t2
6 from lc_tracking_task_record) s
7 where s.t1 = s.t2
8 group by s.t1,s.carrier_code
9 order by count(*) desc
愿你多向优秀的人学习;
愿你不怕麻烦,勤做总结;
愿你每天都有意义;
愿你不负年华;
愿你……
愿你……
愿你……
愿你一生都快乐!