【问题标题】:Getting "Unknown Column" error even though the column exists即使列存在,也会出现“未知列”错误
【发布时间】:2013-08-13 19:30:52
【问题描述】:

我收到一个未知的列错误:

1054 - “where 子句”中的未知列“products_to_categories.products_id”

   SELECT `products`.`products_date_added`, 
`products`.`products_model`, 
`products_description`.`products_name`, 
`products_description`.`products_description`, `products_description`.`products_description_second`

    FROM products, products_description

    WHERE products.products_id=products_description.products_id 
AND products.products_id = products_to_categories.products_id 
AND products_to_categories.categories_id <> '91'or '46' 
    ORDER BY `products`.`products_date_added` DESC

问题是该列存在。我什至检查了拼写。那我是不是做错了什么?

【问题讨论】:

    标签: mysql


    【解决方案1】:

    但它有一个未知的表前缀。 “products_to_categories”不是您在 FROM 子句中选择的表。

    将表 products_to_categories 添加到您的 FROM 部分。

    … FROM products, products_description, products_to_categories ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-28
      • 2021-01-02
      • 2017-12-24
      相关资源
      最近更新 更多