【发布时间】:2017-07-04 17:14:38
【问题描述】:
我在尝试使用当前表 (Table1) 中的一些列并结合第二个表 (Table2) 中的新列在 SQL (Table3) 中创建新表时遇到以下错误:“找不到任何一列“a”或用户定义的函数或聚合“a.sum”,或名称不明确。”
代码如下:
select a. [Quarter]
,a. [Source Location]
,a. [Destination Location]
,a. sum([Total Volume]) as 'Total Volume'
,a. sum([Total Cost]) as 'Total Cost'
,b. [Source_City]
,b. [Source_State]
Into [2016].[dbo].[Table3]
FROM [2016].[dbo].[Table1] a
,[2016].[dbo].[Table2] b
Where a. [Source Location] = b. [Source_Location]
Group By a. [Quarter]
,a. [Source Location]
,a. [Destination Location]
,b. [Source_City]
,b. [Source_State]
错误与 [Quarter] 相关;但是,[Quarter] 是表 1 中定义的列。此外,[Source_Location] 是表 2 中的定义列。
谁能帮助解决这个问题并成功地将这两个表合并为第三个?
感谢您的帮助!
GK
【问题讨论】:
标签: sql sql-server