0
I’m having trouble performing a select on some tables, I did the following.
have 5 tables (module, components, step, images, records)
the table records only receive ID’s from the other tables , it unifies the records in fact,
What I need to do is fetch the records from the other tables based on the id’s that are in the record table. I tried to do so but is returning me repeated values.
SELECT modulo.nome_modulo,modulo.indice,modulo.revisao,componentes.codigo,componentes.local,etapa.etapa,componentes.quantidade,imagens.imagem FROM registros
INNER JOIN etapa ON etapa.id_etapa= registros.id_etapa
INNER JOIN componentes ON componentes.id_componente = registros.id_componente
INNER JOIN imagens ON imagens.id_componente = registros.id_imagem
INNER JOIN modulo ON modulo.id_modulo = registros.id_modulo
WHERE.....
I’m a beginner, I don’t know if this is possible or if this was the best way to do it.
The fourth line shouldn’t be
INNER JOIN imagens ON imagens.id_imagem = registros.id_imagem
instead ofINNER JOIN imagens ON imagens.id_componente = registros.id_imagem
– Vinicius Morais
Vlw brother, that’s right
– Bruno Bandeira