Replaces the DISTINCT clause with GROUP BY.