This should be a simple query but I'm banging my head on my desk over it.
I'm just trying to get a list of users who's email addresses match the pattern '@example.com' and who are not a member of role 21. Here's what I'm trying but it's not working:
Code MySQL:
Here's what the tables look like:
Code MySQL:mysql> SELECT uid, name, mail FROM users LIMIT 5; +-----+------------------+-------------------------+ | uid | name | mail | +-----+------------------+-------------------------+ | 1 | Admin | [email]brian@foo.com[/email] | | 3 | Kevin M. | [email]3+nobody@bar.com[/email] | | 8 | jbuckner | [email]8+nobody@example.com[/email] | | 9 | Mahmoud Ahmadian | [email]9+nobody@example.com[/email] | +-----+------------------+-------------------------+ 5 rows in set (0.00 sec) mysql> describe users_roles; +-------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+------------------+------+-----+---------+-------+ | uid | int(10) unsigned | NO | PRI | 0 | | | rid | int(10) unsigned | NO | PRI | 0 | | +-------+------------------+------+-----+---------+-------+ 2 rows in set (0.00 sec)



Reply With Quote




Bookmarks