查询不会仅返回标题的任何结果

时间:2015-08-19 00:01:05

标签: sql-server-2012 inner-join

INSERT INTO Pricing_Compare (SKU, ScansourcePrice, BluestarPrice, BarcodePrice, Manufacturer, Product)    
   SELECT 
       Product.SKU, Product.Name, ProductVariant.Price, 
       Manufacturer.Name,Scansource.COST, Bluestar.PRICE
   FROM 
       Product 
   INNER JOIN 
       ProductVariant ON Product.ProductID = ProductVariant.ProductID 
   INNER JOIN 
       ProductManufacturer ON Product.ProductID = ProductManufacturer.ProductID 
   INNER JOIN 
       Manufacturer ON ProductManufacturer.ManufacturerID = Manufacturer.ManufacturerID
   INNER JOIN 
       Scansource ON Product.SKU =Scansource.SKU
   INNER JOIN 
       Bluestar ON Product.SKU = Bluestar.MFG_PART_NUMBER

我受到0行的影响。这似乎是直截了当的。无法理解。

1 个答案:

答案 0 :(得分:0)

试试这个。我在select查询中重新排列了列名。

INSERT INTO Pricing_Compare (SKU,ScansourcePrice,BluestarPrice,BarcodePrice,Manufacturer,Product)    
SELECT Product.SKU,Scansource.COST, Bluestar.PRICE, ProductVariant.Price Manufacturer.Name,Product.Name
FROM Product 
INNER JOIN ProductVariant ON Product.ProductID = ProductVariant.ProductID 
INNER JOIN ProductManufacturer ON Product.ProductID = ProductManufacturer.ProductID 
INNER JOIN Manufacturer ON ProductManufacturer.ManufacturerID = Manufacturer.ManufacturerID
INNER JOIN Scansource ON Product.SKU =Scansource.SKU
INNER JOIN Bluestar ON Product.SKU = Bluestar.MFG_PART_NUMBER