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'
最佳答案
请按照下面给出的查询对 FROM 子句中的表重新排序;否则,用于连接 dim_location
和 fact_flight
表的 ON 子句中的连接条件将错误地应用于 dim_date
和 fact_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
关于mysql - 在 pentaho 数据集成 (cdb) 上查询 mysql 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20756350/