• Something like this:

    select *

    from

    TableH h

    where

    exists(select 1 from TableC c where c.[visit#] = h.[visit#] and c.[document name] = 'Doc B');