Hi Felipe,
Here is an article that shows an example on wtpart doing a similar function.
https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS176778
Notice it is important to select from wtdoc, the wtdocmaster, and wtuser.
join doc with masterReference to docmaster
join doc with modifier to user
Then you will be able to add the condition desired.
Thank you,
Jarrett