mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
replacing inner join to BuyingGroups with LEFT JOIN
Fixing logical error in the integration proc. Not all customers are in buying groups.
This commit is contained in:
@@ -64,3 +64,6 @@ samples/applications/iot-smart-grid/Db/obj/Release/Db.sqlproj.FileListAbsolute.t
|
||||
*.manifest
|
||||
samples/applications/iot-smart-grid/WinFormsClient/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
|
||||
samples/databases/wide-world-importers/wwi-ssasmd/wwi-ssasmd/obj/Development/IncrementalShapshot.xml
|
||||
samples/applications/iot-smart-grid/ConsoleClient/bin/Release/Reports/PowerDashboard.pbix
|
||||
samples/applications/iot-smart-grid/Db/obj/Release/Model.xml
|
||||
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/obj/Release/MultithreadedOrderInsert.csproj.FileListAbsolute.txt
|
||||
|
||||
+6
-6
@@ -61,14 +61,14 @@ BEGIN
|
||||
bg.BuyingGroupName, p.FullName, c.DeliveryPostalCode,
|
||||
c.ValidFrom, c.ValidTo
|
||||
FROM Sales.Customers FOR SYSTEM_TIME AS OF @ValidFrom AS c
|
||||
INNER JOIN Sales.BuyingGroups FOR SYSTEM_TIME AS OF @ValidFrom AS bg
|
||||
ON c.BuyingGroupID = bg.BuyingGroupID
|
||||
INNER JOIN Sales.CustomerCategories FOR SYSTEM_TIME AS OF @ValidFrom AS cc
|
||||
ON c.CustomerCategoryID = cc.CustomerCategoryID
|
||||
INNER JOIN Sales.Customers FOR SYSTEM_TIME AS OF @ValidFrom AS bt
|
||||
ON c.BillToCustomerID = bt.CustomerID
|
||||
INNER JOIN [Application].People FOR SYSTEM_TIME AS OF @ValidFrom AS p
|
||||
ON c.PrimaryContactPersonID = p.PersonID
|
||||
LEFT JOIN Sales.BuyingGroups FOR SYSTEM_TIME AS OF @ValidFrom AS bg
|
||||
ON c.BuyingGroupID = bg.BuyingGroupID
|
||||
WHERE c.BuyingGroupID = @BuyingGroupID;
|
||||
|
||||
FETCH NEXT FROM BuyingGroupChangeList INTO @BuyingGroupID, @ValidFrom;
|
||||
@@ -109,14 +109,14 @@ BEGIN
|
||||
bg.BuyingGroupName, p.FullName, c.DeliveryPostalCode,
|
||||
c.ValidFrom, c.ValidTo
|
||||
FROM Sales.Customers FOR SYSTEM_TIME AS OF @ValidFrom AS c
|
||||
INNER JOIN Sales.BuyingGroups FOR SYSTEM_TIME AS OF @ValidFrom AS bg
|
||||
ON c.BuyingGroupID = bg.BuyingGroupID
|
||||
INNER JOIN Sales.CustomerCategories FOR SYSTEM_TIME AS OF @ValidFrom AS cc
|
||||
ON c.CustomerCategoryID = cc.CustomerCategoryID
|
||||
INNER JOIN Sales.Customers FOR SYSTEM_TIME AS OF @ValidFrom AS bt
|
||||
ON c.BillToCustomerID = bt.CustomerID
|
||||
INNER JOIN [Application].People FOR SYSTEM_TIME AS OF @ValidFrom AS p
|
||||
ON c.PrimaryContactPersonID = p.PersonID
|
||||
LEFT JOIN Sales.BuyingGroups FOR SYSTEM_TIME AS OF @ValidFrom AS bg
|
||||
ON c.BuyingGroupID = bg.BuyingGroupID
|
||||
WHERE cc.CustomerCategoryID = @CustomerCategoryID;
|
||||
|
||||
FETCH NEXT FROM CustomerCategoryChangeList INTO @CustomerCategoryID, @ValidFrom;
|
||||
@@ -155,14 +155,14 @@ BEGIN
|
||||
bg.BuyingGroupName, p.FullName, c.DeliveryPostalCode,
|
||||
c.ValidFrom, c.ValidTo
|
||||
FROM Sales.Customers FOR SYSTEM_TIME AS OF @ValidFrom AS c
|
||||
INNER JOIN Sales.BuyingGroups FOR SYSTEM_TIME AS OF @ValidFrom AS bg
|
||||
ON c.BuyingGroupID = bg.BuyingGroupID
|
||||
INNER JOIN Sales.CustomerCategories FOR SYSTEM_TIME AS OF @ValidFrom AS cc
|
||||
ON c.CustomerCategoryID = cc.CustomerCategoryID
|
||||
INNER JOIN Sales.Customers FOR SYSTEM_TIME AS OF @ValidFrom AS bt
|
||||
ON c.BillToCustomerID = bt.CustomerID
|
||||
INNER JOIN [Application].People FOR SYSTEM_TIME AS OF @ValidFrom AS p
|
||||
ON c.PrimaryContactPersonID = p.PersonID
|
||||
LEFT JOIN Sales.BuyingGroups FOR SYSTEM_TIME AS OF @ValidFrom AS bg
|
||||
ON c.BuyingGroupID = bg.BuyingGroupID
|
||||
WHERE c.CustomerID = @CustomerID;
|
||||
|
||||
FETCH NEXT FROM CustomerChangeList INTO @CustomerID, @ValidFrom;
|
||||
|
||||
Reference in New Issue
Block a user