[英]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.