计算天-时-分

SELECT
 a.consume_code consumeCode,
 s.trans_code transCode,
 t.company_name companynName,
 a.wlb_code wlbCode,
 a.user_name userName,
 a.consignee conSignee,
 a.cons_city consCity,
 FLOOR(
  HOUR (
   TIMEDIFF(NOW(), a.order_date)
  ) / 24
 ) ex_order_day,
 MOD (
  HOUR (
   TIMEDIFF(NOW(), a.order_date)
  ),
  24
 ) ex_order_hour,
 MINUTE (
  TIMEDIFF(NOW(), a.order_date)
 ) ex_order_minute,
 a.order_date orderDate
FROM
 rs_sale_order_base a
LEFT JOIN rs_sale_order_service s ON a.consume_code = s.consume_code
LEFT JOIN ru_company_trans t ON s.main_company_code = t.company_code
WHERE
 1 = 1
AND a.consume_code NOT IN (
 SELECT
  h.consume_code
 FROM
  hf_info h
)

你可能感兴趣的:(hour,minute,TIMEDIFF)