Subquery on table links and files

I think you need this: