I want to select only a column from a table that I'm joining into. A separator has a facility, a facility has a customer, and I want to select customer.id by providing a separatorId.
Below is what I have tried, but this returns a Separator.
return await this.separatorRepository
.createQueryBuilder('separator')
.select(['customer.companyId'])
.innerJoin('separator.facility', 'facility')
.innerJoin('facility.customer', 'customer')
.where('separator.id = :separatorId', { separatorId })
.getOne();
How do I change this query to get customer.id?