Hello,
I want to do a query similar to the following:
So, the point of this is to find all customers who didn't place orders in the timeframe.
Problem 1: The query doesn't return any records because we're already getting rid of everyone who hasn't placed an order. So, this means I need to break this up into 2 queries. One to find all the customers that placed orders and another to remove those from the list of all customers.
Problem 2: I want to be able to define what date1 and date2 are at the time the query is run. So, this means I need to do a stored procedure.
So, the query that returns all customers that have not placed an order in the timeframe needs to call the stored procedure, or I need to have 1 stored procedure call another.
I'm stuck, I don't know how to make this work the way I want it to or even if it's possible.
ANY ideas at all?
Thank you,
Evie
I want to do a query similar to the following:
Code:
SELECT CUSTFILE.CustNo, COUNT(MASTER.PONo) AS Expr1
FROM dbo.CUSTFILE LEFT OUTER JOIN MASTER ON CUSTFILE.CustNo = MASTER.CustNo
WHERE (MASTER.OrderDate > date1) OR (MASTER.OrderDate < date2)
GROUP BY CUSTFILE.CustNo
HAVING (COUNT(MASTER.PONo) = 0)
Problem 1: The query doesn't return any records because we're already getting rid of everyone who hasn't placed an order. So, this means I need to break this up into 2 queries. One to find all the customers that placed orders and another to remove those from the list of all customers.
Problem 2: I want to be able to define what date1 and date2 are at the time the query is run. So, this means I need to do a stored procedure.
So, the query that returns all customers that have not placed an order in the timeframe needs to call the stored procedure, or I need to have 1 stored procedure call another.
I'm stuck, I don't know how to make this work the way I want it to or even if it's possible.
ANY ideas at all?
Thank you,
Evie