MySQL Forums
Forum List  »  Performance

Create index for Join some table in MySQL
Posted by: Kenny Nguyen
Date: May 20, 2018 10:44PM

I have SQL query for MySQL database bellow:


SELECT
count(*) AS count,
sum(total) AS total
FROM
vtiger_salesorder
INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_salesorder.salesorderid
INNER JOIN vtiger_sobillads ON vtiger_salesorder.salesorderid = vtiger_sobillads.sobilladdressid
INNER JOIN vtiger_soshipads ON vtiger_salesorder.salesorderid = vtiger_soshipads.soshipaddressid
INNER JOIN vtiger_salesordercf ON vtiger_salesordercf.salesorderid = vtiger_salesorder.salesorderid
INNER JOIN vtiger_account ON vtiger_account.accountid = vtiger_salesorder.accountid
LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_salesordercf.cf_456
LEFT JOIN vtiger_contactdetails ON vtiger_salesorder.contactid = vtiger_contactdetails.contactid
LEFT JOIN vtiger_soshop ON vtiger_soshop.salesorderid = vtiger_salesorder.salesorderid
WHERE
vtiger_crmentity.deleted = 0
ORDER BY
vtiger_crmentity.modifiedtime DESC;

Options: ReplyQuote


Subject
Views
Written By
Posted
Create index for Join some table in MySQL
154
May 20, 2018 10:44PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.