我是SQL和编程的新手,我写的是写一个数据拉动,它可以为我们拥有的每个观察项目的类别和部门提取货币价值。但我遇到了这个错误。任何帮助都非常感谢。
SELECT CAST(ROUND(sales.store_nbr,0) AS INT) AS "Store NUMBER", dept.acct_dept_nbr AS "Department NUMBER", dept.dept_desc AS "Department Description", SUM(sales.wkly_sales) AS "Weekly sales",SUM(sales.yrly_sales) AS "Yearly Sales"
--pull sales and quantity by store
FROM CA_WM_VM.SKU_DLY_POS sales, CA_WM_VM.DEPT_DESC dept, ca_wm_vm.item item, CA_WM_VM_SKU_YRLY_POS sales
--for a store, for a period of time
WHERE sales.item_nbr = item.item_nbr
AND item.dept_nbr = dept.acct_dept_nbr
AND sales.wm_yr_wk BETWEEN 11613 AND 11713
--group by store number, & dept number
GROUP BY sales.store_nbr, dept.acct_dept_nbr, dept.dept_desc
答案 0 :(得分:2)
from子句中的第一个和最后一个表具有相同的别名“sales”。