Bu sql Kodu Belki işini Görür
select *,if(tes1.id=test2.id,'ayni','degil') as durum from tes1,test2 group by tes1.id