Counting unique orders
I have a Customers table and an Order table. I am trying to count the number of "first time orders" each day. Note that customers can exist in the table without first having made an order. So basically, a customer ID should only exist once in the orders table to qualify as a "first time order" but how do I check this? Thanks for any help. Here's what I have so far:
SELECT COUNT(Orders.OrderID) AS NewOrdersToday
FROM Orders
INNER JOIN Customers on Customers.CustID = Orders.CustID
WHERE CAST(CONVERT(char(10), Orders.OrderDateTime, 112) as smalldatetime) = '11/11/2005'
|