Active record - 3 results found, but only one being returned

后端 未结 3 2061
滥情空心
滥情空心 2021-01-28 15:14

The query below is returning that 3 results are available, but it is only returning one entry id.

How can I have the three entry_id\'s returned?

$this-&g         


        
3条回答
  •  南方客
    南方客 (楼主)
    2021-01-28 15:25

    Your $this->EE->db->group_by('portfolio_number'); is causing a single row with aggregated data to be returned.

    If you want all the ids to be returned as well, you can try adding

    $this->EE->db->select('GROUP_CONCAT(entry_id) AS entry_ids', false);
    

    and then splitting the entry_ids field in PHP:

    str_getcsv($submissions);
    

    Edit: I put in the second argument for the select query to prevent backticks being placed around the custom select query.

提交回复
热议问题