标签: mysql node-mysql
我希望通过搜索role.id找出role.name,然后通过匹配他们的user_id = founded role.id
role.id
role.name
user_id = founded role.id
答案 0 :(得分:1)
以下查询将有效:
select id,user_id,username from (select id from Role where name = 'provider') as t join user u on t.id = u.role
答案 1 :(得分:0)
SELECT * FROM users INNER JOIN role on user.role = role.id WHERE role.name = 'provider'