>>>>CREATE SQL VIEW LV_SAVED_SEARCHES AS ; >>>>SELECT Saved_searches.* ; >>>> FROM mmviscollect!saved_searches ; >>>> WHERE Saved_searches.cusgrlink_fk = ( ?vp_cusgrlink_fk ) ; >>>> OR Saved_searches.cusgrlink_fk = ( ?vp_vcam_fk ) ; >>>> ORDER BY Saved_searches.isequence_number>>>>
>CREATE SQL VIEW LV_SAVED_SEARCHES AS ; >SELECT Saved_Searches.* ; > FROM mmviscollect!saved_searches ; > WHERE Saved_searches.cusgrlink_fk = ( ?vp_vcam_fk ) ; > AND NOT EXISTS(SELECT * FROM mmviscollect!saved_searches ; > WHERE Saved_searches.cusgrlink_fk = ( ?vp_cusgrlink_fk )) ; > UNION ; >SELECT Saved_Searches.* ; > FROM mmviscollect!saved_searches ; > WHERE Saved_searches.cusgrlink_fk = ( ?vp_cusgrlink_fk ) >>BTW, if you're comparing both parameters against the same foreign key, how can one return all the records and the other not be identical to return any records?