Download & Extend

SQL Error when limiting list to users in a certain role

Project:Site User List
Version:5.x-1.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hi, all -

I'm hoping somebody can help me, since I'm about to pull the last strand of hair out of my head.

I've got the Site User List working for the most part, but whenever I select to "Restrict the users in the list using user roles" (and then select a role), I get the following SQL error:

user warning: You have an error in your SQL syntax near 'select distinct sul_ur.uid from omca_users_roles as sul_ur where sul_ur.rid =4))' at line 1 query: CREATE TABLE omca_site_user_list_table AS SELECT DISTINCT u.uid as `@uid`, t_1.value as `@profile_first_name`, t_2.value as `@profile_last_name`, t_3.value as `@profile_phone_number`, u.name as `@name`, u.mail as `@mail` FROM omca_users as u LEFT OUTER JOIN omca_profile_values as t_1 on (u.uid = t_1.uid and t_1.fid = 1) LEFT OUTER JOIN omca_profile_values as t_2 on (u.uid = t_2.uid and t_2.fid = 2) LEFT OUTER JOIN omca_profile_values as t_3 on (u.uid = t_3.uid and t_3.fid = 3) WHERE (u.uid != 0) AND (u.status = 1) AND (u.uid in (select distinct sul_ur.uid from omca_users_roles as sul_ur where sul_ur.rid =4)) in /home/virtual/site374/fst/var/www/html/omca.jocara.com/includes/database.mysql.inc on line 172.

The issue is defintely the last subquery - I can run the query fine if I remove the replace the last "select distinct sul_ur.uid from omca_users_roles as sul_ur where sul_ur.rid =4" with constants.

I have MySQL 3.23, and according to http://dev.mysql.com/doc/refman/4.1/en/any-in-some-subqueries.html the subquery is properly formatted and should work fine. Note that it also does not work in the MySQL query analyzer (so it's not specifically a drupal issue).

Does anybody have any ideas on what might be causing this? Any thoughts would be greatly appreciated!

Comments

#1

Figured it out - 3.23 doesn't support subqueries, even though the user manual says it does. This page seems to have a patch, though I haven't been able to get it fully functioning yet: http://drupal.org/node/162970