All pastes #611782 Raw Edit

Jemand

public text v1 · immutable
·published 2007-07-10 02:00 UTC
rendered paste body
SELECT DISTINCT op.products_id, pd.products_name, p.products_image, sum(op.products_quantity) as total FROM orders_products op, orders o, products p, products_description pd WHERE p.products_id = op.products_id AND pd.products_id = op.products_id AND o.orders_id = op.orders_id AND p.products_status = '1' AND o.date_purchased BETWEEN NOW() - INTERVAL 90 DAY AND NOW() GROUP BY op.products_id ORDER BY total DESC LIMIT 5