0
任何人都可以告訴我爲什麼我不能使用codeigniter中的活動記錄顯示以下查詢。我想,有什麼問題TIMEDIFF在我的SELECT語句那裏有TOTAL之間和FROM活動記錄不顯示正確的查詢
這是我的活動記錄查詢
$this->db->select('s.id, s.person_id, p.first_name, p.last_name, sch.id, sch.start_date, sch.start_hour, sch.end_hour, TIMEDIFF(sch.end_hour, sch.start_hour) AS total');
$this->db->join('staff s', 'sch.staff_id = s.id', 'left');
$this->db->join('persons p', 's.person_id = p.id', 'left');
$this->db->where('sch.start_date >=', $start);
$this->db->where('sch.start_date <=', $end);
$this->db->limit(10);
$query = $this->db->get('work_schedule sch');
,這是如何被打印出來
SELECT `s`.`id`,
`s`.`person_id`,
`p`.`first_name`,
`p`.`last_name`,
`sch`.`id`,
`sch`.`start_date`,
`sch`.`start_hour`,
`sch`.`end_hour`,
TIMEDIFF(sch.end_hour,`sch`.`start_hour)` AS totalFROM (`work_schedule` sch)
LEFT JOIN `staff` s ON `sch`.`staff_id` = `s`.`id`
LEFT JOIN `persons` p ON `s`.`person_id` = `p`.`id`
WHERE `sch`.`start_date` >= '2014-02-19'
AND `sch`.`start_date` <= '2014-02-20'LIMIT 10
當我返回$ result-> result();我收到錯誤 –
什麼是錯誤? 'get()'後面忘記加分號。 – lighter