[HG-196] Prevent duplicates on collection

When adding attributes mappings to profile which gets attribute from parent, the collection
could result with duplicates entries.

Add the GROUP BY clause to select to ensure uniqueness.

DISTINCT was not the solution here, see:

http://stackoverflow.com/questions/11416190/mysql-left-join-duplicates-results
http://stackoverflow.com/questions/15483808/sql-join-where-to-place-the-where-condition/15483895#15483895

Possible to add conditions directly on join instead on a where but difficult to tailor when using Magento ORM
for generating queries to not have this condition in generating the sql query for the collection. If more faster
query is needed, we could do it.

http://stackoverflow.com/questions/17349944/multiple-condition-in-join-magento
Merge branch 'HG-196' into development