Hi, A while back you guys helped me make a query that returns all clients that have not made a payment in 90 days. this works good.
I now want to exclude those who have never made a payment.
I tried to add in
Exists (Select Receipts.DateReceived from Receipts)
but no matter where I insert it I can't get it to work. I don't get any errors, but people that have never made a payment still show up. I run that in a query by itself and it works.
here's my current query
SELECT ClientID, WholeName,ClientStatus FROM Clients WITH (NoLock) WHERE (NOT EXISTS (SELECT * FROM Receipts(NOLOCK) WHERE Clients.ClientID = Receipts.ClientID AND Receipts.DateReceived >= getdate() - 90)) AND (ClientStatus LIKE 'active%' ) GROUP BY ClientID, WholeName, ClientStatus Order By Clientid