Thanks Evertjan,

your suggestion was great.
I thought that the problem should be solved with SQL.
Michael's option works as well, but it is much slower.