On Wed, Dec 02, 2009 at 12:20:25AM -0600, Chanoch (Ken) Bloom wrote: > INSERT into orderstats(productid, date, orders) > SELECT > orderitem.productid, orders.timestamp, SUM(orderitem.qty) > FROM orderitem > JOIN orders ON orders.id = orderitem.orderid > WHERE orders.timestamp >= { 90 days ago } > group by orderitem.productid, orders.timestamp > > assuming orders.timestamp has one-day granularity
Timestamp is actually a timestamp (down the second). -bill! _______________________________________________ vox-tech mailing list vox-tech@lists.lugod.org http://lists.lugod.org/mailman/listinfo/vox-tech