Optimización de consulta
De que otro modo puedo realizar la siguiente consulta y que sea más rápida:
SELECT SUM(b.N_BILLETES_VEN *
c.N_PRC_BILLETE)
INTO v_ret
FROM TC a, TMP_VEN_IE b, JGO_IE c
WHERE a.ID_N_PV = p_ID_N_PV AND
b.ID_N_TC = a.ID_N_TC AND
b.ID_N_JR >= v_jornada AND
b.ID_N_JR <= v_jornada AND
b.ID_N_JGO = c.ID_N_JGO AND
ID_D_NOTIF = (Select MAX
(ID_D_NOTIF)
from TMP_VEN_IE d
WHERE d.ID_N_JGO =
b.ID_N_JGO
AND d.ID_N_TC =
b.ID_N_TC
AND d.ID_N_JR =
b.ID_N_JR);
Gracias.
SELECT SUM(b.N_BILLETES_VEN *
c.N_PRC_BILLETE)
INTO v_ret
FROM TC a, TMP_VEN_IE b, JGO_IE c
WHERE a.ID_N_PV = p_ID_N_PV AND
b.ID_N_TC = a.ID_N_TC AND
b.ID_N_JR >= v_jornada AND
b.ID_N_JR <= v_jornada AND
b.ID_N_JGO = c.ID_N_JGO AND
ID_D_NOTIF = (Select MAX
(ID_D_NOTIF)
from TMP_VEN_IE d
WHERE d.ID_N_JGO =
b.ID_N_JGO
AND d.ID_N_TC =
b.ID_N_TC
AND d.ID_N_JR =
b.ID_N_JR);
Gracias.
1 Respuesta
Respuesta de oatienza
1