Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT orderProducts.*, SUM(quantity) AS `total`, products.name as ownName FROM `orderProducts` LEFT JOIN `products` ON orderProducts.product_id = products.prodid LEFT JOIN `orders` ON orderProducts.order_id = orders.order_id WHERE `product_id` != 'Z2001' AND (`product_id` LIKE 'E%' OR `product_id` LIKE 'M%' OR `product_id` LIKE 'X%' OR `product_id` LIKE 'U%' OR `product_id` LIKE 'CM%') AND orderProducts.order_id > '76' AND orders.Valid = '1' GROUP BY `product_id` ORDER BY `total` DESC LIMIT 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement