reduce junctionsTable to unique set