我想笨相当于下面的SQL:
select * from `table_name` where DATE_FORMAT('table_name', "%Y-%m") < "YYYY-MM"
我曾经尝试过,但我做到了让NULL作为answer.Here是
$this->db->select_sum('column_name')->from('table_name')->where("DATE_FORMAT('column_name','%Y-%m') <","YYYY-MM")->get();
日Thnx任何帮助?
使用不带引号column_name
像DATE_FORMAT(column_name,'%Y-%m')
$this->db->select_sum('column_name')
->from('table_name')
->where("DATE_FORMAT(column_name,'%Y-%m') <","YYYY-MM")
->get();
尝试这个
$this->db->select_sum('column_name')
->from('table_name')
->where("DATE_FORMAT('column_name','%Y-%m') < YYYY-MM")
->get();
您可以手动编写自己的条款在... 阅读文档
尝试这个
$this->db->select("DATE_FORMAT(your_date_field, 'Year: %Y Month: %m Day: %d') AS formated_date");
$query = $this->db->get('your_table');
你只是去通过这个THREADS