Add department to nominal ledger

Hi, I essentially I want to see my nominal ledger, split by department. 

I'm building a report in Excel that uses the connection properties and command type of SQL to extract data from the SAGE databases, but I'm not seeing any links between departments and nominal ledger. Is there a middle table I can link trough?