Mysql日期函數說明

一、獲取當天日期函數

current_date  ->   2019-07-17 00:00:00spa

 

二、獲取昨天日期函數code

date_sub(current_date,INTERVAL 1 day)   ->   2019-07-16 00:00:00blog

使用舉例:產品

1 select * from `t_settlement_roi` where settlement_date = date_sub(current_date,INTERVAL 1 day)
2 
3 INSERT INTO `t_settlement_roi` (`id`, `merchant_id`, `product_code`, `prod_name`, `settlement_date`, `uv`, `charge_type`, `roi_uv`, `product_price`, `total_register_num`, `register_price`, `cpa_conversion_rate`, `total_settlement_amount`, `del_flag`, `create_time`, `update_time`) 
4 VALUES(NULL,'f5a71edc785f4ce5a9e3cc5daa6ddf1f','54c4ed0d14684934bf4ef3fb687c3435','第三個產品',DATE_SUB(CURRENT_DATE,INTERVAL 1 DAY),'4','2','16.00','11.00','4','16.00','0.2000','64.00','0',CURRENT_DATE,CURRENT_DATE);
相關文章
相關標籤/搜索