On Tue, Dec 01, 2009 at 05:32:20PM -0800, Bill Kendrick wrote:
> Anyone feel like flexing their MySQL muscles and provide some
> ideas on how to populate a similar table (tracking sales) based
> on the orders/orderitem table combo explained above?
> 
> Thanks.  Sorry for asking you to do my (home)work for me.

Maybe as simple as something like:

SELECT
  orderitem.productid,
  SUM(orderitem.qty),
  FROM_DAYS(TO_DAYS(orders.ordertime)) AS day
FROM orders
JOIN orderitem ON orders.id = orderitem.orderid
GROUP BY productid,day

???

-bill!
_______________________________________________
vox-tech mailing list
[email protected]
http://lists.lugod.org/mailman/listinfo/vox-tech

Reply via email to