作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有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
我试图从两个不同的表中获取值,以便 IT 仅返回两个表中存在的公共(public)值,但它只返回一个空查询。我检查过两者都有一个共同的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 * from one table然后从一个表中选择*加入另一个表然后从一个表中选择 * 连接另一个表连接第三个然后 select * from one table join another join 第三个和 where 条件 1,您将很容易知道它失败的地方......
关于php - mysql 查询可以有 2 个内连接和 2 个 IN 子句吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23340089/
我是一名优秀的程序员,十分优秀!