Subject improving select statement
Author Sergio H. Gonzalez
Hello!! I just need to select the last occurence of the field "UNITARIO" and
it's ID

This does the job, but I wander if there is a better option.

ID and ID_STOCK has indexes, and the plan reports that they are being used


SELECT
F.UNITARIO, F.ID

FROM
FAC_COM_DETALLE F

WHERE
(F.ID_STOCK=:ID_STOCK)
AND
(F.ID = (select MAX(D.ID) from fac_com_detalle D WHERE D.id_stock =
:ID_STOCK))


THANK YOU !!!

sergio