If SQL Server
IF EXISTS (SELECT * FROM tblOne WHERE field1 = @parm1 AND field2 = @parm2) OR EXISTS (SELECT * FROM tblTwo WHERE field1 = @parm5 AND field2 = @parm3) PRINT 'YES'
Great, note that only one thing has changed: EXISTS not EXIST . The plan for this is likely to be UNION ALL , that short circuits, if first checked, are true.
source share