SELECT gal.titulo, fot.url FROM fotos fot INNER JOIN galeria gal ON gal.id = fot.galeria GROUP by fot.galeria ORDER by gal.id DESC LIMIT 6