我,我尝试将我的表格列数据显示在一行中... mysql查询是可行的,但我无法获取数据显示
function get_daily_attendances_row($fldCompanyStringID){ $fldCompanyID = getCoompanyByStringID($fldCompanyStringID)->fldCompanyID; $sql = "SELECT * , SUM(CASE WHEN `fldAttendanceAction` = '0' THEN `fldAttendanceTime` END) AS `OUT` , SUM(CASE WHEN `fldAttendanceAction` = '1' THEN `fldAttendanceTime` END) AS `IN` , SUM(CASE WHEN `fldAttendanceAction` = '2' THEN `fldAttendanceTime` END) AS `LUNCH IN` , SUM(CASE WHEN `fldAttendanceAction` = '3' THEN `fldAttendanceTime` END) AS `LUNCH OUT` FROM `tblAttendance` WHERE fldUserID = ". loggedInUserID() ." AND fldCompanyID = $fldCompanyID GROUP BY `fldAttendanceDate`"; $query = $this->db->query($sql); $result = $query->result_array();
我想在我的视图表中显示该值
这是我的控制器
$data['get_daily_attendances_row'] = $this->M_attendance->get_daily_attendances_row($fldCompanyStringID); }
答案 0 :(得分:0)
我建议您将查询转换为mysql上的存储过程,并从codeigniter执行SP。