Skip to content

Commit a69c9ef

Browse files
Update Advanced SQL Puzzles Solutions.sql
1 parent ebfc04b commit a69c9ef

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Advanced SQL Puzzles/Advanced SQL Puzzles Solutions.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2985,7 +2985,7 @@ FROM #ProductsA a FULL OUTER JOIN
29852985
SELECT 'Matches in both table A and table B' AS [Type],
29862986
ProductNameA
29872987
FROM cte_FullOuter
2988-
WHERE ProductNameA = ProductNameB
2988+
WHERE ProductNameA = ProductNameB AND QuantityA = QuantityB
29892989
UNION
29902990
SELECT 'Product does not exist in table B' AS [Type],
29912991
ProductNameA
@@ -3000,7 +3000,7 @@ UNION
30003000
SELECT 'Quantities in table A and table B do not match' AS [Type],
30013001
ProductNameA
30023002
FROM cte_FullOuter
3003-
WHERE QuantityA <> QuantityB;
3003+
WHERE ProductNameA = ProductNameB AND QuantityA <> QuantityB;
30043004
GO
30053005

30063006
/*----------------------------------------------------

0 commit comments

Comments
 (0)