How can I make this query to use Not in condition not in the whole table but limit the condition for each customer
SELECT
dbo.Service.Service_ID
,dbo.Service.Service_RNO
,dbo.Customer.Cust_Name
,dbo.Service.Agrement_ID
,dbo.Customer.Cust_ID
,dbo.Service.Service_Date
,dbo.Service.Next_Service
FROM
dbo.Service
INNER JOIN
dbo.Customer ON dbo.Service.Cust_ID = dbo.Customer.Cust_ID
WHERE
Next_Service BETWEEN '2016-01-01' AND '2016-02-01'
AND Next_Service NOT IN (SELECT Service_Date from Service)
ORDER BY
Next_Service
For example let's say I have this data
Service_ID Service_RNO Cust_Name Agrement_ID Cust_ID Service_Date Next_Service
1 1 customer1 35 15 2016-01-01 2016-01-31
2 2 customer1 35 15 2016-01-31 2016-03-2
3 3 customer2 12 21 2016-01-31 2016-03-2
out put of this query will be empty since the next service is existed in the service_date
The query should give customer 2 rows of data since Next_Service not existed in service_date for that customer