The best approach here would be to enforce the Identify Duplicate Rows option in a "Clean" step right after you use the custom SQl node
the Is Duplicate Row? column will identify the duplicates for you and you can filter them