PDA

View Full Version : Excluding users from queri..


RichieBoy67
06-11-2005, 08:58 PM
This is similiar to my last question. I would like to exclude certain users from the following queri. This is not the same queri in my last question and I do not know where to include a where clause??

Thanks :)


$DB_site->query("SELECT userid, lastactivity, options, username, user.usergroupid, displaygroupid,
groupa.opentag as opentaga, groupa.closetag as closetaga, groupb.opentag as opentagb, groupb.closetag as closetagb
FROM " . TABLE_PREFIX . "user as user
LEFT JOIN " . TABLE_PREFIX . "usergroup as groupa ON(user.usergroupid = groupa.usergroupid)
LEFT JOIN " . TABLE_PREFIX . "usergroup as groupb ON(user.displaygroupid = groupb.usergroupid)
WHERE lastactivity > " .$cutoff. " ORDER BY username" );

filburt1
06-11-2005, 09:03 PM
Query, not queri (queries is plural).

But anyway, the generic method for excluding specific users is to add the clause

userid NOT IN (1, 2, 3...)