結合したい 3 つのテーブルがあり、希望どおりに正確に機能する次の SELECT クエリを使用していますが、ロードに非常に長い時間がかかるという問題があります。その理由は、正しい結合が 2 つあるためだとわかっていますが、このクエリを別の方法で記述する方法はありますか?
どうもありがとう/リンダ
$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";