phpmyadmin 中的以下查询根据我的需要返回具有三个不同条目 ID 的三列 (entry_id)。
SELECT sub_1.entry_id, sub_2.entry_id, sub_3.entry_id
FROM exp_judging_portfolios AS jud
LEFT JOIN exp_submissions AS sub_1 ON sub_1.id = jud.rel_id_1
LEFT JOIN exp_submissions AS sub_2 ON sub_2.id = jud.rel_id_2
LEFT JOIN exp_submissions AS sub_3 ON sub_3.id = jud.rel_id_3
WHERE sub_1.member_group = $member_group
AND jud.pre = 1
GROUP BY jud.rel_id_1
但是,当我在页面中返回结果时,我得到一个只有一个条目 ID 的数组。
这是我用来生成结果的代码
$sql = "
SELECT sub_1.entry_id, sub_2.entry_id, sub_3.entry_id
FROM exp_judging_portfolios AS jud
LEFT JOIN exp_submissions AS sub_1 ON sub_1.id = jud.rel_id_1
LEFT JOIN exp_submissions AS sub_2 ON sub_2.id = jud.rel_id_2
LEFT JOIN exp_submissions AS sub_3 ON sub_3.id = jud.rel_id_3
WHERE sub_1.member_group = $member_group
AND jud.pre = 1
GROUP BY jud.rel_id_1
";
$query = $this->EE->db->query($sql);
$submissions_portfolio = $query->result_array();
print_r($submissions_portfolio);
这是返回的内容:
Array ( [0] => 354 )
有谁知道为什么?如果是这样,如何返回所有 3 个条目 ID?