[英]Can mysql query have 2 inner join with 2 IN clause?
我有4個不同的mysql表,
SELECT node.created AS node_created, node.nid AS nid, node.title AS title
FROM node
INNER JOIN field_data_field_resume_education ON field_data_field_resume_education.entity_id = node.nid
INNER JOIN
field_data_field_resume_of_study ON
field_data_field_resume_of_study.entity_id =
field_data_field_resume_education.field_resume_education_value
INNER JOIN
field_data_field_resume_degree_level ON
field_data_field_resume_degree_level.entity_id =
field_data_field_resume_education.field_resume_education_value
WHERE field_data_field_resume_degree_level.field_resume_degree_level_tid IN (4,7)
AND field_data_field_resume_of_study.field_resume_of_study_tid IN (18,19,21)
and (node.status = '1')
AND (node.type IN ('resume_content '))
GROUP BY nid
ORDER BY node_created DESC
我試圖從2個不同的表中獲取值,以便IT僅返回兩個表中都存在的通用值,但它只返回一個空查詢。 我檢查了兩個都有一個共同的nodeid。
在where子句中可以有2個IN子句條件嗎?
請告訴我代碼有什么問題。
如果不是問題node.type IN('resume_content'),則檢查另外兩個連接以及其中的所有條件,其中一個連接將失敗,例如連接field_data_field_resume_of_study.entity_id = field_data_field_resume_education.field_resume_education_value
可能失敗。
您應該從一個表中執行select *,然后從一個表中選擇*,然后從一個表中選擇*,然后從一個表中選擇*,從第三個表中選擇*,然后從第三個表中選擇*,從另一個表中選擇第3個條件,在第1個條件下,您將很容易知道其失敗之處...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.