esatto, ho fatto un order by foto.id ed è andato tutto a posto
graziee!!