[Amazon](500310)无效操作:对表“ fact_spv_commissioned_lot”的FROM子句条目的引用无效;

时间:2019-04-29 19:46:25

标签: sql amazon-redshift

我已经看过一些关于stackoverflow的类似问题,但是没有一个对我有帮助。无论我做什么,我都会不断收到此错误。

Amazon无效操作:对表“ fact_spv_commissioned_lot”的FROM子句条目的引用无效;

SELECT COUNT(*) FROM staging_serials s
  JOIN dim_md_company c ON (c.lsc_company_id = s.companyid)
  JOIN staging_product p ON (s.compositeproductcode = p.compositeproductcode)
  JOIN dim_packaging_level l ON (l.unit_of_measure = p.packaginguom)
WHERE c.sk_company_id = fact_spv_commissioned_lot.sk_company_id
  AND s.lotnumber = fact_spv_commissioned_lot.lot_number
  and p.sk_product_id = fact_spv_commissioned_lot.sk_product_id
  and l.sk_packaging_level_id = fact_spv_commissioned_lot.sk_packaging_level_id

1 个答案:

答案 0 :(得分:1)

因为fact_spv_commissioned_lot没有在查询的表子句中列出。您正在加入staging_serialsdim_md_companystaging_productdim_packaging_level表。您需要包括fact_spv_commissioned_lot表。