It would be good to understand the business problem you are trying to solve really.
Since you seem to be trying to implement automatic behaviour, you can implement your request with scenarios:
- Set your Flag in an editable dataset;
- Create two different scenarios with SQL triggers, with exclusive conditions;
- Each scenario builds a different dataset (the output of the join or the output of the sync).
I hope this helps.