pentaho数据集成(cdb)上的错误查询mysql

时间:2013-12-24 06:58:54

标签: mysql pentaho

mysql查询是:

SELECT
    dim_location.country_name,
    COUNT(fact_flight.sk_fact)
FROM
    dim_location, dim_date
    INNER JOIN fact_flight ON dim_location.sk_location = fact_flight.sk_location
WHERE
    fact_flight.date_key = dim_date.date_key
GROUP BY
    dim_location.country_name

但它不起作用,这是错误信息

#1054 - Unknown column 'dim_location.sk_location' in 'on clause'

1 个答案:

答案 0 :(得分:1)

请按照下面给出的查询重新排序FROM子句中的表格;否则,ON子句中用于加入dim_locationfact_flight表的连接条件将被错误地应用于dim_datefact_flight表会导致上述错误:

SELECT
    dim_location.country_name,
    COUNT(fact_flight.sk_fact)
FROM
    dim_date, dim_location
    INNER JOIN fact_flight ON dim_location.sk_location = fact_flight.sk_location
WHERE
    fact_flight.date_key = dim_date.date_key
GROUP BY
    dim_location.country_name