skip to Main Content

Mysql in Query to join query Optimisation

Trying to debug a slow query: SELECT IFNULL(SUM(bt.transactionQuantity * bpd.unitPrice), 0) FROM batchTransaction bt LEFT JOIN batch b ON b.id = bt.batchId LEFT JOIN batchPricingDetails bpd ON bpd.id = b.batchPricingDetailsId WHERE (bt.productId, bt.dateCreated) IN ( SELECT productId, MAX(dateCreated) FROM batchTransaction…

VIEW QUESTION

Mysql – Optimizing INNER JOINS SQL query

I have a query like this: SELECT DISTINCTROW customers.id, customers.customer_name FROM customers INNER JOIN rentals ON customers.id = rentals.id_customer INNER JOIN rentals_billing ON rentals.id = rentals_billing.id_rental INNER JOIN vehicles ON vehicles.id = rentals.id_vehicle WHERE (rentals_billing.customer_id_facsimile IS NULL AND rentals_billing.rental_payable =…

VIEW QUESTION
Back To Top
Search