Sorry for this simple question, but i’m missing the forest through the trees.
These are my tables (i left the sparepart-table because i’m only looking for two special fk’s):

(source: bilder-hochladen.net)
I need the distinct rows from tabData which are referenced in the child-table tabDataDetail with fiSparePart=8837 and 8969.
The following gives me only that rows which have at least one sparepart, but i need those which have both. They are also not distinct, because of the having clause.
SELECT tabData.idData
FROM tabData INNER JOIN
tabDataDetail ON tabData.idData = tabDataDetail.fiData
GROUP BY tabData.idData, tabDataDetail.fiSparePart
HAVING tabDataDetail.fiSparePart IN (8837, 8969)
ORDER BY tabData.idData
Thanks for your time.
This should give you the tabData records that have both 8837 and 8969 as spare parts. You can use DISTINCT, and you don’t need the group by.