select Id from ( select b.SId as Id,a.Id as OId ,a.Casno from dbo.CrmProductCas a join dbo.tmpsynccas b on a.Casno=b.Ca_no where a.Casno <> '') as d group by Id having count(1)>1