Assuming that
order_products8
is a table with many to many relationships between
orders
and
products8
tables,
- to get count of products
SELECT op.order_id, COUNT(op.product_id) CountOfProductsInOrder
FROM order_products8 AS op
GROUPBY op.order_id
WHERE op.date_ordered='2011-01-10';
- to get max number of products in order
SELECT dt.order_id, MAX(CountOfProductsInOrder) TheHigestNumberOfProductsInOrder
FROM (
) AS dt
GROUPBY dt.order_id;