我从MS Access中使用的可视化编辑器方法切换到SQL Server。这是我的第一次尝试。我正在加入两个表并继续获取无效对象。我哪里错了?错误消息具体说明:
(560180 row(s) affected)
Msg 208, Level 16, State 1, Line 20
Invalid object name 'BillingTable'.
我的查询是:
SELECT [Tracking_Number]
,[Package_Key]
,[Manifest_Datetime]
,[Packed_Datetime]
,[Order_Number]
,[WMS_Order_Number]
,[Shipped_Warehouse_Name]
,[Carrier]
,[Service_Name]
,[Zone]
,[Estimated_Weight]
,[Estimated_Cost]
,[Preferred_Warehouse_Name]
,[WMS_Shipping_Method_Name]
FROM [Shipping].[dim].[tbl_Package] as PackageTable
where [Manifest_Datetime] > '1/1/2016'
SELECT [Invoice_Date_Key]
,[Order_Date_Key]
,[Package_Key]
,[Billed_Weight]
,[Billed_Weight_Metric]
,[Package_Quantity]
,[Total_Cost_Dollars]
,[Tax_Cost_Dollars]
,[Total_Cost_Billed_Currency]
FROM [Shipping].[fact].[tbl_Shipping_Billing] as BillingTable
JOIN BillingTable
on PackageTable.Package_Key = BillingTable.Package_Key
答案 0 :(得分:1)
您的查询应如下所示:
Select PackageTable.*, BillingTable.*
From [Shipping].[dim].[tbl_Package] as PackageTable
Inner Join [Shipping].[fact].[tbl_Shipping_Billing] as BillingTable
on PackageTable.Package_Key = BillingTable.Package_Key
where PackageTable.[Manifest_Datetime] > '1/1/2016'
您可以从这些表中调出所需的特定字段,而不是使用.*