error query mysql on pentaho data integration (cdb)

爷,独闯天下 提交于 2019-12-13 15:46:24

问题


mysql query is :

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

but it's doesn't work and this is error message

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

回答1:


Please re-order the tables in the FROM clause as in the query given below; otherwise, the join condition in the ON clause that is meant to be applied to joining the dim_location and fact_flight tables, will be wrongly applied to the dim_date and fact_flight tables which would result in the above error:

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


来源:https://stackoverflow.com/questions/20756350/error-query-mysql-on-pentaho-data-integration-cdb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!