如何在2018/12/30之前获取数据
t_report
+------------------------------------------+
| id_report | id_head_report | date_report |
+------------------------------------------+
| 1 | 3 | 2019/01/30 |
+------------------------------------------+
| 2 | 2 | 2018/12/30 |
+------------------------------------------+
查询
$id = $this->report_model->get_by_id($id);
$report = $this->db->query("SELECT DATE_FORMAT(date_report, '%m')-01 AS report FROM t_report WHERE id_report=$id")->row()->report;
print_r($ report)
1 SELECT DATE_FORMAT(date_report,'%m')-01 AS报告from t_report WHERE id_report = 2