簡體   English   中英

如何在 Codeigniter 4 中使用 WHERE 子句

[英]How to use WHERE CLAUSE in Codeigniter 4

您好,我有 2 張學生和教師表,我想將它們稱為我的索引(視圖),所以我想出了如何加入它們。 但是我有一個問題,我需要將這兩個表分成一個類別,但我不知道代碼。 有人可以幫幫我嗎?

 public function getStudentReguler()
{
    return $this->db->table('student')
        ->join('faculty', 'faculty.id_faculty = student.id_student')
        ->where('category', *i want to be like, where categor = A*)
        ->get()->getResultArray();
}

謝謝你

public function getStudentReguler()
{
    return $this->db->table('student')
        ->join('faculty', 'faculty.id_faculty = student.id_student')
        ->where('category', 'A')
        ->get()->getResultArray();
}

請試試這個:

$this->db->select('*')
->from('student')
->join('faculty', 'faculty.id_faculty = student.id_student')
->where('category', 'A')
->get()->getResultArray();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM