Guest Wellington Rodrigues da Silva Report post Posted April 1, 2005 Alquem pode me ajudar.. tenho que fazer uma consulta em tres tabbelassão elas: CURSOS, COMPCADALUNO, CADALUNOda tabela de CADALUNO tenho que pegar os campos "CODIGO", "DESC_ALUNO", "DT_INICIO"da tabela COMPLCADALUNO tenho que pegar esses campos "CODIGO", COD_CURSO"sendo que o COMPLCADALUNO.CODIGO = CADALUNO.CODIGOai devo pegar o COD_CURSO da tabela COMPLCADALUNO COM ISSO EU TENHO QUE PEGAR A DESCRIÇÃO DO CURSO COM O campo "COD_CURSO" da tabela COMPLCADALUNOou seja tenho que fazer inner joine não sei fazer.. alguém me ajude [email protected]obrigado Quote Share this post Link to post Share on other sites
0 Luiz Humberto 0 Report post Posted April 1, 2005 SELECT CUR.CODIGO ,CUR.DESC_ALUNO ,CUR.DT_INICIO ,COMP.CODIGO ,COMP.COD_CURSOFROM Cursos CUR ,CompCadAluno COM ,CadAluno ALUWHERE COM.CODIGO = ALU.CODIGO AND ALU.CODIGO = COM.CODIGOObs: Na cláusula where os relacionamentos é de Filho para Pai.Qualquer dúvida poste... Quote Share this post Link to post Share on other sites
0 diegoinfo 0 Report post Posted April 4, 2005 Tem como fazer isso sem que as tabelas tenham relacionamento? Quote Share this post Link to post Share on other sites
0 Luiz Humberto 0 Report post Posted April 5, 2005 Tem sim, mas é importante que crie os relacionamentos para que sua base de dados tenha integridade. Quote Share this post Link to post Share on other sites
Alquem pode me ajudar.. tenho que fazer uma consulta em tres tabbelas
são elas: CURSOS, COMPCADALUNO, CADALUNO
da tabela de CADALUNO tenho que pegar os campos "CODIGO", "DESC_ALUNO", "DT_INICIO"
da tabela COMPLCADALUNO tenho que pegar esses campos "CODIGO", COD_CURSO"
sendo que o COMPLCADALUNO.CODIGO = CADALUNO.CODIGO
ai devo pegar o COD_CURSO da tabela COMPLCADALUNO
COM ISSO EU TENHO QUE PEGAR A DESCRIÇÃO DO CURSO COM O campo "COD_CURSO" da tabela COMPLCADALUNO
ou seja tenho que fazer inner join
e não sei fazer.. alguém me ajude

[email protected]
obrigado
Share this post
Link to post
Share on other sites