我的SQL查询是
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_fact AND
dim_date.date_key = fact_flight.date_key
WHERE
fact_flight.date_key = dim_date.date_key
GROUP BY
dim_location.country_name
我们希望显示基于位置的日期名称,但它不起作用并发现错误:
#1054 - 未知栏' dim_date.date_key'在' on条款'
答案 0 :(得分:0)
请按照下面给出的查询重新排序FROM子句中的表格;
选择 dim_location.country_name, COUNT(fact_flight.sk_fact) 从 dim_date,dim_location INNER JOIN fact_flight ON dim_location.sk_location = fact_flight.sk_location 哪里 fact_flight.date_key = dim_date.date_key 通过...分组 dim_location.country_name;