-1
SELECT 
           f_workorders_shipments.date,
           f_inventory.id AS item_id,
           f_workorders_shipments.inventory_code AS code,
           f_inventory`.status,
           f_inventory.type,
           f_workorders.id AS order_id
         FROM f_workorders
         LEFT JOIN f_workorders_shipments
         ON f_workorders.id = f_workorders_shipments.order_id
         LEFT JOIN `f_inventory`
         ON f_workorders_shipments.inventory_code = f_inventory.code
         WHERE contact_id = "'.$_POST['id'].'"
         AND inventory_code IS NOT NULL
         ORDER BY due DESC'
4

1 回答 1

0

由于连接将要检查的行数相乘,因此您必须注意索引。

请为每个对过滤或与其他表中的其他字段连接很重要的字段建立索引。

一个好的索引可以减少执行 sql 命令的时间

于 2012-11-19T10:22:09.383 回答