Skip to content Skip to sidebar Skip to footer

Sql Query For Vendors Who Have Sold Item More Than Once

I need help with the following query...Show the names of vendors who have sold us an item more than once. List the vendor, item, and the number of times ordered. Suppose a vendor

Solution 1:

SELECT vendor.name, partnum, COUNT (DISTINCT ponum) AS times_ordered
FROM purchaseorder
JOIN vendor USING (vendorid)
JOIN poitems USING (ponum)
GROUP BY vendorid, partnum
HAVING times_ordered > 1

Post a Comment for "Sql Query For Vendors Who Have Sold Item More Than Once"