私は現在、Codeigniterのクエリに取り組んでいます。ここでは、たくさんの結果を得ようとしています。しかし、同じクエリ内でgroup_byとorder_byの両方を使用すると、order_byは無効になり、何らかの理由で適用されません。Codeigniter group_byとOrder_byの競合
クエリは以下の通りです:
$this->db->select('q.questionNumber, qa.qaId')->from('questions q');
$this->db->join('questionAnswers qa', 'qa.questionId = q.questionId');
$this->db->where('customerId', $customerId);
$this->db->order_by('q.questionNumber', 'desc');
$this->db->group_by('q.subject');
$query = $this->db->get();
$query->result();
@S_NoBEIはうまくいきますか? –