Finding the first occurrence where id don't match
How about something like this?

select top 1 snum 
from #temp1 
group by SNum
having count(*) &lt; (select count(*) from #temp2) 
order by snum asc


This could work if you're sure that there are no duplicates vernum for the same snum

This by the way, i think is a more solid solution:

select top 1 coalesce(a.snum, b.snum) as result
from #temp1 a full join #temp1 b on a.SNum = b.SNum and a.VerNum &lt;&gt; b.VerNum
where a.VerNum is null or b.VerNum is null


I didn't test them much, only with the data you provided, so be careful!