Menu
Is there a way of simplifying this, in MYSQL Admin it took over 20 seconds to run, it’s been run inside a class so could I make it more generic but then filter results in PHP code?
“`
SELECT p.ID, p.ProductName, p.Price, p.SpecialPrice, p.ProductDetail, p.ProductImage, p.ProductStatus, p.ListingType, p.CategoryID, p.DateCreated, COUNT(i.InventoryID) As Qnty
FROM `products` p
LEFT JOIN `inventory` i ON i.ProductID = p.ID
WHERE i.OrderID IS NULL
group by p.ID
HAVING Qnty > 0 or p.ListingType = 0