Group by or distinct in for-loop

SOLVED

Hello,

Is it possible to make a for-loop with a SQL "group by" or "select distinct" statement?

Br, Carl