I have 3 tables
TB_ContratoCotista:
TB_Contract:
TB_Cotist:
I would like to relate the values of the TB_Contract table with TB_Cotist but the way I got it just returns the result of the TB_Contract . What am I missing?
SELECT * FROM TB_Contrato
INNER JOIN (SELECT id_contrato FROM TB_Cotista
INNER JOIN TB_ContratoCotista
ON TB_Cotista.id_cotista = TB_ContratoCotista.id_cotista) AS VAI
ON TB_Contrato.id_contrato= VAI.id_contrato