Posta un dump delle due tabelle popolate con qualche record e il risultato che vorresti ottenere.