Ver originalSELECT prod.idproduct, prod.name, inv.stock FROM inventory inv INNER JOIN products prod ON prod.idproduct = inv.idproduct WHERE inv.idzone = 1 GROUP BY inv.idproduct HAVING MAX(inv.id) ORDER BY 1 DESC LIMIT 2;