i gues this is what you want...declare @table1 table (class int,name varchar(50),completed int)insert into @table1select 9,'name1',1 union allselect 9,'name2',1 union allselect 9,'name3',1declare @table2 table (class int, name varchar(50),not_completed int)insert into @table2select 9,'name1',1 union allselect 9,'name4',1select coalesce(t1.class,t2.class),coalesce(t1.name,t2.name),coalesce(t1.completed,0),coalesce(t2.not_completed,0)from @table1 t1 full outer join @table2 t2 on t1.class = t2.class and t1.name = t2.name
except... why does Name4 have a completed count of 1 in your example?Em