Reading the link between vendor invoices and cr memo

I need to create a SQL Server query to read the Vendor Ledger Entry and the Detailed Vendor Ledger Entry.

I know that for a value of document no_ and document type I have a unique entry on the Vendor Ledger Entry.

I need to know which are the cr memos linked for a certain invoice or viceversa by using a SQL Server query

Do you any suggests to solve this issue?

Many thanks