i m applying union on single table and i want apply inner join with union in codeigniter on it. how can i do that i have tryed many ways but everytime i got syntax error
this is my code:-
$this->db->select(' COUNT(marks.old_id) AS count, MIN(marks.mark) AS min , MAX(marks.mark) AS max ')
->from('marks')
->where('type', 'hard')
->group_by('marks.id');
$this->db->get();
$query1 = $this->db->last_query();
$this->db->select(' COUNT(marks.old_id) AS count, MIN(marks.mark) AS min , MAX(marks.mark) AS max ')
->from('marks')
->where('type', 'easy')
->group_by('marks.id');
$this->db->get();
$query2 = $this->db->last_query();
$query = $this->db->query($query1 . ' UNION ' . $query2);
// $this->db->select('newuser.*')
// ->from('newuser')
// ->join('marks', 'newuser.id = marks.old_id', 'left')
// ->group_by('newuser.id')
// ->order_by('newuser.id', 'ace');
return $query->result();
please help me...