Maybe my brain is not on this morning, but this query pulls all records
when it sums, not just from the records of the date range. Did I miss
something fundamental here before my coffee?
Thanks!
Select
COUNT (customer_orders_prod.product_id) as totsales,
SUM (customer_orders_prod.line_total) as grosssales,
SUM (customer_orders_prod.qty) as totunits,
inventory.service_name
FROM customer_orders
LEFT OUTER JOIN customer_orders_prod on customer_orders.id =
customer_orders_prod.order_id
JOIN inventory on customer_orders_prod.product_id =
inventory.service_id
WHERE customer_orders.orderdate BETWEEN
#CreateODBCDate('1/1/2005')# AND #CreateODBCDate(DateAdd('D', 1,
form.end1))#
AND inventory.vendor <> 57
AND inventory.client_id = 4 or inventory.client_id = 5
GROUP BY service_name
Order by service_name ASC
Eric
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211014
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54