Hi PFC
Thanks for this! It has sped up complete - now in fact there is no delay!
A few tweaks had to be made to the code ; here it is:
select breakdown.alignment, sum(cnt) as num FROM
( (select alignment.name as class, count(1) as cnt
from weapons,
alignment
where weapons.level < (select level_id from users where uid =
$userid)
and cost = 0
and alignment.id = weapons.align_id
group by alignment.name)
UNION ALL
select b.class as class, count(1) as cnt
from weapons w, user_weapons uu, alignment b
where tu.weaponid = uu.weaponid
and uu.user_id = ($userid)
and b.id = tu.id
group by b.class ) as breakdown
group by breakdown.class;
Essentially you had skipped a few brackets and I had forgotten to note one
of the tables. It works!
Thanks a lot!!
Mike
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend