T SQL, Get new customer added or deleted from historical table
Not sure I completely understand your intention or the difference between Table1 and Table2.
If you are trying to find just the IDs that only occur once in the last two days.
SELECT StaffID, count(StaffID)
FROM Table1 
WHERE CensusDate &gt;= cast(dateadd(day, -2, getdate()) as date)
Group By StaffID