what want query count of hoursbilled . want first check #worked if data not exist in table want pull data #workschedule . my issue seems totalling data twice, i.e. if exists in both tables counts hoursbilled twice. works fine on test data, when roll out production data issue occurs. incorrect join, or bad query set-up? need can accurate count of hoursbilled ? essentially query trying is: if date exists in table #worked use hoursbilled table if date not exist use hoursbilled #workschedule create table #workschedule ( caldate date ,isworkday varchar(5) ,hoursbilled int ) insert #workschedule values ('01/01/2000', 'yes','3'), ('01/02/2000', 'yes','3'), ('01/03/2000', 'yes','1'), ('01/04/2000', 'no','0'), ('01/05/2000', 'yes','12'), ('01/06/2000', 'no','0') create table #worked ( d1 date ,hoursbilled int ...