SELECT Id, ContentDocumentId, LinkedEntityId, ShareType, Visibility 
FROM ContentDocumentLink 
WHERE ContentDocumentId IN (SELECT Id FROM ContentDocument)