select u.urunID, case when ur.AnaResim is null then '0' else '1' end as anaresim from urunler u with(nolock) left join urunresimleri ur with(nolock) on u.urunID = ur.urunID