如何在MySQL上比较两个表

I have three tables on MySQL:

users_data
id[PK]
name

users_permissions
userid[FK]
moduid[FK]

modules
id[PK]
name

I want to print the modules.name table for the user that has only an entry on the permissions table base on the moduid[FK].

Does anybody can help me with this? I just don't know how to do it...

select m.name
from users_data ud
inner join users_permissions p on ud.id = p.userid
inner join modules m on m.id = ud.moduid