SELECT
case_id,
serialnumber,
DateLastHere,
Bookedindate,
DATEDIFF(DateLastHere,Bookedindate)
FROM `cases`
WHERE serialnumber like 'TTTT46'
答案 0 :(得分:3)
你可以这样做
$data = array(
'case_id',
'serialnumber',
'DateLastHere',
'Bookedindate',
'DATEDIFF(DateLastHere,Bookedindate)'
);
$this->db->select($data);
$this->db->from('cases');
$this->db->like('serialnumber','TTTT46');
$query = $this->db->get()->result_array();