-3
I have an INNER JOIN that is duplicating records in the view. Because in the database such records are not duplicated.
select
conta.dominio,
conta.id,
conta.modelo,
imoveis.id,
imoveis.cod,
imoveis.titulo,
imoveis.vvenda,
imoveis.vtemporada,
imoveis.vanual,
imoveis.tipo,
fotos.cod,
fotos.foto,
imoveis.descricao,
imoveis.cidade,
imoveis.data,
imoveis.endereco,
conta.nome,
imoveis.dormitorio,
imoveis.banheiro,
imoveis.atotal,
imoveis.areatotalmedida
from
conta
inner join imoveis on
conta.id = imoveis.cod
inner join fotos on
fotos.cod = imoveis.id;
How to solve this question? Why this is happening?
Thanks.
Show me the keys of the tables, put the definition of each one there.
– DeRamon
I imagine that if there are N photos by immovable, soon will repeat his information for photo, can explain better the context of the code?
– rray
Take a test ! puts select * from account Inner Join immobles on account.id = immovable.Cod Inner Join photos on photos.Cod = immovable.id; , and checks if there are actually duplicate lines ( all returned fields must be identical , have something different if not a select distinct would work )
– John Diego