Refs #4594 - Adds ability to remove DISTINCT modifier from SQL by passin...

...g 'distinct' => false in $options. That does not fix the ticket, but gives ability to optimize queries without breaking compatibility.