我被卡住了,我有三个要加入的表,并且我正在使用以下 SELECT 查询,它完全按照我的意愿工作,但问题是加载需要很长时间。我知道原因是因为我有两个右连接,有没有办法以不同的方式编写这个查询?
非常感谢/琳达
$qu = "SELECT PULAGART.D5810 as blager, PULAGER.D1001 as D1001,
PULAGER.D18900 as D18900, PULAGER.D1115 as D1115, PULAGER.D1021 as D1021,
PULAGER.D1081 as D1081, PULAGER.D1031 as D1031, PULAGER.D1124 as D1124, PULAGER.D1154 as D1154, PULAGER.D1159 as D1159, PULAGER.D1040 as D1040
FROM PULAGER
RIGHT JOIN PUPRIREG ON (PULAGER.D1001=PUPRIREG.D25306)
RIGHT JOIN PULAGART ON (PULAGER.D1001=PULAGART.D5801)
WHERE (PUPRIREG.D25301 = 'REA') AND (PULAGART.D5810 = 'BS') AND (PULAGART.D5832 > 0) AND (PULAGER.D1159 <> '' AND PULAGER.D1040 <> '' AND
(PULAGER.D1115 NOT LIKE 'SP%') AND PULAGER.D1082 = 'www') AND (".$varugrupper.") ORDER BY $orderby";