Fix duplicated columns for count()

When a same aggregate function was used more than once in a 'having'
clause, count() added that function more than once to 'select'.