SQL Help - Searching from multiple usergroups
[sql]$db->query_first("SELECT homepage AS url FROM user WHERE usergroupid = 5 || 6 || 7 || 9 ||12 AND homepage != '' AND lastpost > UNIX_TIMESTAMP(NOW())-86400 ORDER BY RAND() LIMIT 1");[/sql]
The query above works only with 2 numbers in the usergroupid field (one OR). Once I move it up to 3 it fails to work correctly. How do I fix?
|