CodeIgniter Forums
problem with query - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: problem with query (/thread-71188.html)



problem with query - jokerbwo - 07-17-2018

I have a problem, I make the following query:
SELECT
    dop.ID_CAJERO,
    dop.NUM_SERIE,
    CONCAT(us.apUsuario,' ',us.amUsuario,' ',us.nomUsuario) AS TECNICO ,
    CASE
        WHEN dop.V_F IS NULL THEN FORMAT( dop.MONTO_PAGADO, 2 )
        ELSE FORMAT(dop.V_R,2)
    END as MONTO_PAGADO, 
    dop.FECHA_PAGO,
    dop.HORA_PAGO,
    dop.FOLIO_FORMAVALORADA,
    dop.FOLIO_CONTROL,
    dop.CONTRIBUYENTE,
    dop.SERIE_FOLIOS,
    ifnull(dop.V_R,dop.MONTO_
PAGADO) V_R,
    ifnull(dop.V_F,dop.MONTO_PAGADO) V_F,
    ifnull(dop.V_D,0) V_D,
    ifnull(dop.FECHA_APP,dop.FECHA_PAGO) FECHA_CAJERO   
FROM det_operacion dop
JOIN cat_cajeros cat on cat.NUMERO=dop.ID_CAJERO
JOIN cat_usuario us on us.idUsuario=cat.NOMBRE_TECNICO
WHERE dop.ESTATUS_PAGO = 'PAGADO'
-- AND dop.FOLIO_FORMAVALORADA between '429359' and '429382' and dop.ID_CAJERO = 7010
 AND dop.FECHA_PAGO BETWEEN '2018-05-01' AND '2018-07-15' and dop.ID_PROYECTO = 1
 AND dop.MONTO_PAGADO <= 79


  But it takes a long time to be done and it does not yield the results that I can do?