我似乎在让我的多左连接给我正确的结果时遇到了一些问题,它给了我很好的 ID,但是我似乎无法获得链接来给我结果问题而不是 ID。
代码如下。
SELECT
a.id as id,
a.clientid as clientid,
a.comp_id as compid,
a.title as title,
a.firstname as firstname,
a.lastname as lastname,
a.countrycode as countrycode,
a.mobile as mobile,
a.question1_answer as question1_answer,
a.question2_answer as question2_answer,
a.question3_answer as question3_answer,
a.timestamp as timestamp,
b.comp_name as comp_name,
b.comp_id as comp_id,
a.question1 as question1,
a.question2 as question2,
a.question3 as question3
FROM
competition_entries AS a
LEFT JOIN
competition as b
ON
a.comp_id = b.id
LEFT JOIN
questions as q
ON
a.question1 = q.question_id
AND
a.question2 = q.question_id
AND
a.question3 = q.question_id
WHERE
a.comp_id = '$download_id'
但是,每次我调用 question1 / question2 / question3 - 显示的唯一结果是在另一个表中对应于它们的 ID 的数值。