I was wondering if someone could help me make the following query efficient. It's tying up a lot of resources:
$query = "SELECT * FROM user, usergroup, userfield
WHERE user.usergroupid = usergroup.usergroupid
AND user.userid = userfield.userid
AND user.usergroupid = $report_id
OR user.usergroupid = $report_id;";
Basically, the problem seems to come from when I try to join two usergroupid's with multiple report_ids.
Any help would be appreciated.
Thanks.