select * from users join user_roles on (user_roles. user_id = id) join roles on (roles.id = role_id) where username like '%foo%';