So I need to have the name as a column and then also street but it doesn't work.
I tried this
SELECT naam, straat FROM activiteit GROUP BY naam HAVING COUNT(*)>1;
expected to have this
naam | straat |
--------+--------+
tennis | Gent |
basket | Antwerpen |
but got this
column "activiteit.straat" must appear in the GROUP BY clause or be used in an aggregate function
If you have multiple streets for every name, yove to decide which tio take A MIN MAX or any other aggregation function will do
the following will show you all streets with the same name
SELECT naam, string_agg(istinct straat , ',') as straat
FROM activiteit
GROUP BY naam
HAVING COUNT(*)>1;