se non ho capito male il tuo problema forse dovresti usare nella query l'opzione EXISTS ed adattarla al tuo scopo
Regole del Forum