Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql查询在Mysql 5.6.10和5.6.46上未返回预期结果?_Mysql_Database - Fatal编程技术网

Mysql查询在Mysql 5.6.10和5.6.46上未返回预期结果?

Mysql查询在Mysql 5.6.10和5.6.46上未返回预期结果?,mysql,database,Mysql,Database,当我执行以下查询时: SELECT node_field_data.title, node_field_data.type, node_field_data.status, node_field_data.nid, node_field_data.created AS node_field_data_created FROM node_field_data LEFT JOIN ( SELECT taxonomy_term_fi

当我执行以下查询时:


SELECT
  node_field_data.title,
  node_field_data.type,
  node_field_data.status,
  node_field_data.nid,
  node_field_data.created AS node_field_data_created 
FROM
  node_field_data 
  LEFT JOIN
    (
      SELECT
        taxonomy_term_field_data.*,
        taxonomy_index.nid 
      FROM
        taxonomy_term_field_data 
        LEFT JOIN
          taxonomy_index 
          ON taxonomy_index.tid = taxonomy_term_field_data.tid 
      WHERE
        taxonomy_term_field_data.vid IN 
        (
          'blog_post_tags'
        )
    )
    taxonomy_term_field_data_node_field_data 
    ON node_field_data.nid = taxonomy_term_field_data_node_field_data.nid 
WHERE
  (
(taxonomy_term_field_data_node_field_data.name = 'lung cancer')
  )
  AND 
  (
(node_field_data.status = '1')
  )
  LIMIT 1;

我得到以下结果:

+------------------------------------------+-----------+--------+-------+-------------------------+
| title                                    | type      | status | nid   | node_field_data_created |
+------------------------------------------+-----------+--------+-------+-------------------------+
| xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| blog_post |      1 | 14339 |              1332187581 |
+------------------------------------------+-----------+--------+-------+-------------------------+
然后我以以下方式添加where子句
和(node\u field\u data.type IN('blog\u post')

SELECT
  node_field_data.title,
  node_field_data.type,
  node_field_data.status,
  node_field_data.nid,
  node_field_data.created AS node_field_data_created 
FROM
  node_field_data 
  LEFT JOIN
    (
      SELECT
        taxonomy_term_field_data.*,
        taxonomy_index.nid 
      FROM
        taxonomy_term_field_data 
        LEFT JOIN
          taxonomy_index 
          ON taxonomy_index.tid = taxonomy_term_field_data.tid 
      WHERE
        taxonomy_term_field_data.vid IN 
        (
          'blog_post_tags'
        )
    )
    taxonomy_term_field_data_node_field_data 
    ON node_field_data.nid = taxonomy_term_field_data_node_field_data.nid 
WHERE
  (
(taxonomy_term_field_data_node_field_data.name = 'lung cancer')
  )
  AND 
  (
(node_field_data.status = '1') 
    AND node_field_data.type = 'blog_post'
  )
;
我没有得到任何结果(
empty set(0.001秒)
在前面的查询中,类型
blog\u post
存在


值得注意的是,在不同的mysql服务器版本
5.6.43
上使用相同的db数据是可行的。问题发生在mysql版本
5.6.10

节点字段数据的数据类型是什么。type?如果是CHAR/VARCHAR?文本,则是开始查找非打印字符的时候了。添加
LEN(节点\字段\数据类型)
对于您提出的第一个查询,如果不是9,那么可能就是问题所在。如果是enum…嗯,enum很奇怪。尽管MySQL版本有不同,但我认为这不是一个非打印字符问题,除非数据的记录/还原略有不同。谢谢,这是一个很好的猜测,但它是varchar(32)和返回的长度9可能会检查表中是否有错误?如果该字段已编制索引,且索引以某种方式过期或损坏,则可能会导致类似问题。