-2
I have several images for a site that I am doing. I wanted to show only the last image that was registered for a particular product. I know with left Join will pull up all the images and that I need a subquery to pull this last image, but this query is not working.
Thanks in advance
<?php
$query = "SELECT * FROM {$this->prefix}produtos p ";
$query .= " left join {$this->prefix}imagens img on img.img_pro_id = pro_id ";
$query .= " INNER JOIN {$this->prefix}categorias c ON p.pro_categoria = c.cate_id ";
$query .= " WHERE pro_ativo = 1 ORDER BY pro_id DESC";
Didn’t solve for me friend... I ended up getting the subquery built the other day
– gabrielfalieri
@gabrielfalieri you can answer your own question to help other people who happen to arrive here
– Pedro Sanção