2
I’m having a problem making the relationship with two tables, tb_adm_anuncios
and tb_adm_anuncio_banner
.
For each ad I have 4 banners, and to list these ads I need:
**Anúncio:**
-Nome do Anúncio
-Link
**Banner:**
-Imagem
The command I’m using to do this is this:
SELECT
anuncios.id AS id_anuncio,
anuncios.titulo_anuncio,
banners.id AS id_banner,
Rand(banners.imagem) AS imagem_banner
FROM tb_adm_anuncio AS anuncios
LEFT JOIN tb_adm_anuncio_banner AS banners ON anuncios.id = banners.fk_anuncio AND
anuncios.status = 1
GROUP BY banners.fk_anuncio
limit 12
When I execute this command he does not return me all the ads, and I do not know the reason.
Which version of Mysql you use?
– rray
@rray The MYSQL version is 5.7.19
– Alexandre Vieira de Souza