Това звучи като класическа употреба за EXISTS
оператор:
SELECT *
FROM mytable a
WHERE EXISTS (SELECT 1
FROM mytable b
WHERE a.foreignkey = b.foreignkey
AND trainer IS NOT NULL
AND trainer <> 'FREE'
РЕДАКТИРАНЕ:
Ако просто искате различен различен foreignkey
s:
SELECT DISTINCT foreignkey
FROM mytable a
WHERE EXISTS (SELECT 1
FROM mytable b
WHERE a.foreignkey = b.foreignkey
AND trainer IS NOT NULL
AND trainer <> 'FREE'