i want a result filtered by id and number of rcount.
this is my objectives table
objective_question table
i already have this query with codeigniter
$this->db->select("objectives.id, objectives.rcount, objective_questions.question, objective_questions.a, objective_questions.b,
objective_questions.c, objective_questions.d, objective_questions.answer");
$this->db->from("objectives");
$this->db->join("objective_questions", "objectives.id = objective_questions.objective_id");
$this->db->where("sub_module_id", $sub_module_id);
$query = $this->db->get();
with this result of
what i want is to query the sub_module_id and pick a random question by the number of rcount where objectives.id is equal to objective_questions.objective_id, so total of question will i get based on my two tables is 9, 1 + 4 + 4 = 9.
the result i want is something like this, based on rcount and get random result where sub_module_id = 1 and where objectives.id is equal to objective_questions.objective_id
any idea how do i get the result? Thank you.!
Aucun commentaire:
Enregistrer un commentaire