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