Who Purchased Product ABC?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 years ago
I need a report that provides me who purchased a specific product.  For example, I have product ABC.  150 units sold for this product.  How do I get a list of the people who purchased product ABC.

Product     Customer        Cost
ABC          John Smith      $23.99
ABC          Jennifer Gray   $23.99

Any help would be greatly appreciated!
14 years ago
SELECT     P.Name, C.Username, PV.PriceInclTax
FROM         Nop_Order AS O INNER JOIN
                      Nop_OrderProductVariant AS PV ON O.OrderID = PV.OrderID INNER JOIN
                      Nop_Customer AS C ON O.CustomerID = C.CustomerID INNER JOIN
                      Nop_ProductVariant AS NPV ON PV.ProductVariantID = NPV.ProductVariantId INNER JOIN
                      Nop_Product AS P ON NPV.ProductID = P.ProductId
where P.Name = 'ABC'
14 years ago
This assumes your Product Name never changed.  You'd be better to change your where statement to something like where P.ProductID = 53
14 years ago
Thanks Skiltz!  Your post pointed me in the right direction and gave me the insight I was looking for.  Ultimately, I was able to formalize my query by aliasing the returned columns and drilling down into the Nop_CustomerAttributes table to find the FirstName and LastName attributes.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.