SELECT @CampTot = COUNT(*) FROM tableB WHERE ID=@ID IF @CampTot = 0 SELECT * FROM tableA ELSE SELECT * FROM tableA JOIN tableB ON tableA.ID=@tableB.ID ...Above very simple sample works but I have to check not one but three tables and checking for different combinations with lots of IF...ELSE scatter all over the place with duplicate but only slightly different SELECT statements is a big mess. TIA.