Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Microsoft Access how do I build a query that tell me; The people who buy Prod

ID: 653389 • Letter: I

Question

In Microsoft Access how do I build a query that tell me; The people who buy Product A also purchase what other products? This is what I have so far.

SELECT Customers.ContactName, Products.ProductName
FROM Products INNER JOIN ((Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID) INNER JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID) ON Products.ProductID = [Order Details].ProductID
GROUP BY Customers.ContactName, Products.ProductName
HAVING (((Products.ProductName)="Product A"))
ORDER BY Customers.ContactName;

Explanation / Answer

Your query is very complex ..you make more comparisions..I hope we can write it with less complexity.

SELECT Customers.ContactName,Products.ProductName From products INNER JOIN Customers,Products,Order GROUP BY Customers.ContactName, Products.ProductName
HAVING (((Products.ProductName)="Product A") AND Products.ProductID=Order.ProductID)
ORDER BY Customers.ContactName;

First of all getting all productID's with productname = product A...with that product Id we are fetching all orders having same product ID

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote