I have a query in which I'm trying to find how many customers from one database exist in another.
select customerid
from transactions
where dtcreated > '5/2/14' in (Select customerid
from database2.dbo.customers
where dtcreated > '3/1/14')
Group by customerid
This query works just fine. But obviously, some customers did not have transactions in the time period I'm searching for in the transactions. I'm trying to find those customer ID's.
I've tried:
Select customerid
from database2.dbo.customers
where dtcreated > '3/1/14' NOT IN (select customerid
from transactions
where dtcreated > '5/2/14')
group by customerid
But this query doesn't return any results.