0
I’ve been in trouble for a few days. I have a select that does some Inners and should return 3 lines, but one of the Inners has several results linked to the searched result; how to limit this Inner to take only the first result and select continue returning the 3 lines?
SELECT `imovel`.`imvValorImovel`, `imovel`.`imvCodigo`,
`imovel`.`broCodigo`, `imovel`.`imvDormitorio`, `imovel`.`imvSuite`,
`imovel`.`tpoCodigo`, `imovel`.`imvGaragem`, `bairro`.`broNome`,
`tipo`.`tpoNome`, `imagem_imovel`.`imaNome`
FROM `imovel`
INNER JOIN `bairro` ON `imovel`.`broCodigo` = `bairro`.`broCodigo`
INNER JOIN `tipo` ON `imovel`.`tpoCodigo` = `tipo`.`tpoCodigo`
INNER JOIN `bairro` ON `imovel`.`broCodigo` = `bairro`.`broCodigo`
INNER JOIN `imagem_imovel` ON `imovel`.`imvCodigo` = `imagem_imovel`.`imvCodigo
WHERE `imovel`.`broCodigo` = "'.$resultado->broCodigo.'"
AND `imovel`.`tpoCodigo` = "'.$resultado->tpoCodigo.'"
AND `imovel`.`imvFinalidade` = "'.$resultado->imvFinalidade.'"
LIMIT 3
which Inner returns more than one result ? which limitation will be applied ?
– Rovann Linhalis
the last one, with immovable image, the limitation is to take only one result from this table and continue running the query.
– Vinicius Yuri