customize datatable fetching sum of that fields.but the filed came unknown column in field list.

customize datatable fetching sum of that fields.but the filed came unknown column in field list.

kiruthigakiruthiga Posts: 3Questions: 2Answers: 0
try {
        $this->load->library('datatables');
        $query = $this->datatables->select('
                                employee_info.employee_id as employee_id,
                                employee_info.employee_name,
                                e.designation_name,
                                 scale_pay.name,
                                  SUM(employee_info.basic_pay) as basic_pay,
                                 employee_info.grade_pay,
                                 0 as total,
                                 c.da,
                                 c.hra,
                                 c.ta,
                                 c.da_on_ta,
                                 c.fma,
                                 0 as total_salary,
                                 0 as begin_total,
                                 0 as gpf,
                                 0 as final_total
                            ')->from('employee_info')
                ->join('scale_pay ', 'scale_pay.id = employee_info.scale_of_pay', 'left')
                ->join('designation e', 'e.designation_id = employee_info.designation_id')
                ->join('month_pay c', 'c.employee_id = employee_info.employee_id')
                ->join('monthly_deduction f', 'f.employee_id = employee_info.employee_id AND f.monthyear')
                ->group_by('employee_info.employee_id')
                ->group_by('employee_info.basic_pay')
                ->where($where);
        echo $this->datatables->generate();
    } catch (Exception $e) {

        throw new Exception("Error Processing Request", 1);
    }

Answers

  • kiruthigakiruthiga Posts: 3Questions: 2Answers: 0

    Same Employee having More than 1 row.so,want to be cumulative columns value make a single row.but,i used sum function for cumulative the field.but.error came unknown column

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @kiruthiga ,

    Can you say what error you're getting, please?

    Cheers,

    Colin

This discussion has been closed.