MySQL内部加入'未知列'

时间:2012-03-09 09:22:47

标签: mysql syntax-error inner-join iunknown

我对此进行了阅读,但仍无法理解为什么我的查询不起作用。这是一个相当简单的INNER JOIN,我们正在开发MySQL5。我知道,连接的变化与明确调用连接的优先级相比。但我没有做任何事情。

我的汇编查询如下所示:

SELECT SQL_CALC_FOUND_ROWS k_services.id, service_status, service_tourno, service_date, service_cxlDate, service_difficultPeriod, service_priority, service_currency, service_key_so, service_price_so, service_key_ok, service_price_cfm, service_supplement 
    FROM  k_services
    JOIN k_remarks ON k_remarks.remark_service = k_services.id
    WHERE  k_services.service_market = 2 AND k_remarks.remark_type = 9
    LIMIT 0, 25

这给我一个错误:

  

'where子句中的未知列'k_remarks.remark_type'。

但是,当我将这个完全相同的查询弹出到SQLyog中时,它会对期望/预期的结果执行得很好。

1 个答案:

答案 0 :(得分:0)

尝试:


SELECT SQL_CALC_FOUND_ROWS k_services.id, service_status, service_tourno, service_date, service_cxlDate, service_difficultPeriod, service_priority, service_currency, service_key_so, service_price_so, service_key_ok, service_price_cfm, service_supplement 
    FROM  k_services
    JOIN k_remarks ON (k_remarks.remark_service = k_services.id AND k_remarks.remark_type = 9)
    WHERE  k_services.service_market = 2 
    LIMIT 0, 25