I have a custom plugin which queries users and usermeta, but I now need to filter admins out of the results. A very simplified version of my sql query is:
SELECT * FROM usermeta LEFT JOIN users ON users.ID = user_id WHERE meta_key = 'last_name' AND user_role != 'admin' ORDER BY meta_value ASC LIMIT 0, 25
user_role is not a field, and i saw how it is stored as a config string, but i don't see how to make an equivalent query to this. Am i missing something?