SELECT @cou=COUNT(*) FROM tablo INNER JOIN tablo2ON tablo1.ID= tablo2.tablo1.ID İF @cou>5 (işlem) ELSE BEGİN (işlem)