Sarcoth
03-23-2007, 07:38 PM
Here is the main query I am using.
$users = $db->query_read_slave("
SELECT user.*, usergroup.usergroupid, usergroup.title, user.options, usertextfield.*, userfield.*,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid
FROM " . TABLE_PREFIX . "usergroup AS usergroup
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.usergroupid = usergroup.usergroupid OR FIND_IN_SET(usergroup.usergroupid, user.membergroupids))
LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)
LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid=user.userid)
");
I have a new table called roster in my database. It has a field in common with userfield table from above. 'userfield.field7' is equal to 'roster.CharID'. The following is the query I'm using for the new table.
$query = $vbulletin->db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "roster
");
I've tried a bunch of things and for some reason, I just can't get these two combined into one. Does anyone know what I should do to get them combined? I just want to have one query so I don't have to nest the 2nd query somewhere within the first array.
Any help would be appreciated.
Thanks.
$users = $db->query_read_slave("
SELECT user.*, usergroup.usergroupid, usergroup.title, user.options, usertextfield.*, userfield.*,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid
FROM " . TABLE_PREFIX . "usergroup AS usergroup
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.usergroupid = usergroup.usergroupid OR FIND_IN_SET(usergroup.usergroupid, user.membergroupids))
LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)
LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid=user.userid)
");
I have a new table called roster in my database. It has a field in common with userfield table from above. 'userfield.field7' is equal to 'roster.CharID'. The following is the query I'm using for the new table.
$query = $vbulletin->db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "roster
");
I've tried a bunch of things and for some reason, I just can't get these two combined into one. Does anyone know what I should do to get them combined? I just want to have one query so I don't have to nest the 2nd query somewhere within the first array.
Any help would be appreciated.
Thanks.