Merge pull request #1494 from graciani/bug_fix_v6r7

FIX: Use DN and Group to select Pilots
v6r7p31
FIX: make MySQL do an UNIQUE selection and use implicit loop, huge
speed up for large results