Retail inventory system Mysql query optimization
问题 I'm looking to optimize the following Mysql query that is used to calculate the cost of inventory for a number of stores, I'm running the following query through a PHP loop for each distinct store and outputting the result: Query: SELECT SUM(((( (SELECT COALESCE(SUM(facturas_fabrica.cantidad), 0) FROM facturas_fabrica INNER JOIN entradas_pedidos_productos ON entradas_pedidos_productos.clave = facturas_fabrica.entradas_pedidos_productos_clave INNER JOIN entradas_pedidos ON entradas_pedidos