Print Page | Close Window

Average Items Per Order

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Suggestions
Forum Description: ProductCart Suggestions
URL: https://forum.productcart.com/forum_posts.asp?TID=661
Printed Date: 29-November-2024 at 3:53am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Average Items Per Order
Posted By: MOlson
Subject: Average Items Per Order
Date Posted: 14-February-2007 at 6:14pm

I need a little help with some SQL.  We are registering with shop.org and they are asking for some data on our site.  Could someone help me with the query for:

Average Number of Items Per Order for 2006

Thanks in advance for any help.  I've busted out the old college database books and it scares me.




Replies:
Posted By: MOlson
Date Posted: 16-February-2007 at 1:07pm

I think I got it, if anyone sees a problem with this please let me know, just don't tell my Marketing department

SELECT orders.idOrder, SUM(ProductsOrdered.quantity) as "Total Products"

FROM orders INNER JOIN ProductsOrdered ON orders.idOrder = ProductsOrdered.idOrder

WHERE ((orderStatus > 2 AND orderStatus < 5) OR (orderStatus > 6 AND orderStatus < 9)) AND orderDate >= '01/01/2006' AND orderDate <= '12/31/2006'

GROUP BY orders.idOrder

order by orders.idOrder;




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net