我有一个疑问。假设我得到了:

Invoice (Cod, CodCustomer)
Customer (Cod,Name)


我想选择X发票的客户名称:

SELECT Customer.Name FROM Invoice,Customer WHERE Customer.Cod = CodCustomer AND Invoice.Cod = "X"


在优化过程中,如果我这样做

Customer.Cod = CodCustomer


要么

CodCustomer = Customer.Cod




谢谢 :)

最佳答案

否。但是您可以在此之前执行第二个AND。

SELECT Customer.Name FROM Invoice,Customer WHERE Invoice.Cod = "X" AND Customer.Cod = CodCustomer


如果没有Cod作为“ x”的发票,那么这可能会改善您的性能。

10-07 14:06