HPCC-10022 Ensure duplicate persists within a query are still caught

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Merge pull request #4942 from ghalliday/issue10022b

HPCC-10022 Ensure duplicate persists within a query are still caught

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>