ciao,

posta 'bene' la struttura delle tabelle, e posta anche la select che hai scritto