我检查了以前的帖子,但没有一个解决我的问题,任何帮助将不胜感激
MYSQL 查询 3 个表(用户、匹配、面试)
想要返回指定 Match 的用户名和采访号(如果有采访号)。
但我不想将结果仅限于接受采访的用户。我尝试了 JOIN,但无法让它为 3 个表工作。
这是我到目前为止在 PHP 中的内容:
$query = "SELECT CONCAT(u.first_name,' ',u.last_name,'----',COALESCE(i.v_code,'')) as name, u.id as id
FROM #__users as u
JOIN #__bl_match as m ON ( (u.team_id = m.team1_id) OR
(u.team_id = m.team2_id) OR
(u.team_id = m.team3_id AND m.team3_id != 0) OR
(u.team_id = m.team4_id AND m.team4_id != 0) OR
(u.team_id = m.team5_id AND m.team5_id != 0) OR
(u.team_id = m.team6_id AND m.team6_id != 0) OR
(u.team_id = m.team7_id AND m.team7_id != 0) OR
(u.team_id = m.team8_id AND m.team8_id != 0) OR
(u.team_id = m.team9_id AND m.team9_id != 0) OR
(u.team_id = m.team10_id AND m.team10_id != 0))
AND m.id = ".$t_id."AND m.id != 0
JOIN #__bl_interview as i ON i.u_id = u.id";
$db->setQuery($query);
$parti12 = $db->loadObjectList();