我有一个相当大的查询,它的快递部分使它不起作用我不知道为什么,没有出现错误,但也许我没有看到任何东西......
SELECT o.purchaseNo, o.dateCreated, c.Name, m.mouldName, cr.courierName
FROM products AS p
INNER JOIN orderedProducts AS op ON op.productID = p.productID
INNER JOIN orders AS o ON op.orderID = o.orderID
INNER JOIN Couriers AS cr ON cr.couriersID = o.couriersID
INNER JOIN customers AS c ON c.customerID = o.customerID
INNER JOIN Moulds AS m ON m.mouldID = p.mouldID
WHERE c.Name LIKE '%john%'
OR p.name LIKE '%john%'
OR c.Name LIKE '%john%'
OR c.POC1 LIKE '%john%'
OR c.POC2 LIKE '%john%'
OR c.Address1 LIKE '%john%'
OR c.Address2 LIKE '%john%'
OR c.Suburb LIKE '%john%'
OR c.State LIKE '%john%'
OR c.Phone LIKE '%john%'
OR c.Email LIKE '%john%'
OR c.ABN LIKE '%john%'
OR c.Fax LIKE '%john%'
OR c.CompanyName LIKE '%john%'
OR o.purchaseNo LIKE '%john%'
OR o.dateCreated LIKE '%john%'
OR cr.courierName like '%john%'
Couriers cr 是导致问题的线路。如果我将它与对 cr 的任何引用一起删除,它就可以正常工作。否则不会。
关于可能导致这种情况的任何想法?
我基本上是在创建一个搜索查询。检查数据库中的许多表。如果您对我如何使它变得更好有任何建议,那就太好了:)