考虑以下MySQL语句
SELECT AccountNumber, Currency, Balance
FROM clients
JOIN balances ON clients.AccountNumber= balances.AccountNumber
WHERE date > “2009-01-01”
查询运行缓慢,请描述您将尝试解决此问题的方法。
最佳答案
尝试这个:
SELECT C.AccountNumber, C.Currency, B.Balance FROM clients C INNER JOIN balances B ON C.AccountNumber=B.AccountNumber WHERE C.date > “2009-01-01”
(我假设:表余额中的余额字段)
关于mysql - 优化慢查询,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9893553/