My own controller:
$crud = new grocery_CRUD();
$crud->set_theme('mix');
$crud->set_table('rhp_contrat_travail');
$crud->set_model('carriere_model');
$crud->display_as('dep_id','Département')
->display_as('pst_id','Poste')
->display_as('sal_id','Salarié')
->display_as('cat_id','Catégorie');
$crud->set_relation('pst_id','rhp_poste','pst_nom');
$crud->unset_print();
$crud->unset_export();
$crud->unset_edit();
$crud->unset_delete();
$output = $crud->render();
$this->_example_output($output);
My own model:
public function get_list() {
$query=$this->_database->query('SELECT s.*, tmp.* FROM rhp_salarie as s
LEFT JOIN ( SELECT *, MAX(historisation) AS derniere_date FROM rhp_contrat_travail GROUP BY sal_id )
tmp ON tmp.sal_id = s.sal_id
WHERE tmp.sal_id IS NOT NULL ORDER BY s.sal_id ');
$results_array=$query->result();
return $results_array;
}
Why do I have this? (repeated twice)
SELECT * FROM (`rhp_contrat_travail`) LEFT JOIN `rhp_poste` as ja8eccde7 ON `ja8eccde7`.`pst_id` = `rhp_contrat_travail`.`pst_id` LEFT JOIN `rhp_poste` as ja8eccde7 ON `ja8eccde7`.`pst_id` = `rhp_contrat_travail`.`pst_id`
Please give me a quick help