I am stuck, I have three tables that I would like to join and I am using the follwing SELECT query which works exacly as I would like it to do, but the problem is that it takes a very long time to load. I know that the reason is because I have two right joins, is there a way of writing this query in a different way?
many thanks /Linda
$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";