If i am defining innerjoin or leftjoin in subquery of leftjoinandselect, then it is giving me error sqlMessage: “Duplicate column name ‘id'”.
For example
.leftJoinAndSelect(
(qb) =>
qb
.from(Email, 'email')
.innerJoin(User, 'user')
.where('user.account = :account', {
accountId: 4,
}),
'email',
'`email`.`id` = 1',
)
The above will give me error “Duplicate column name ‘id'”
But if i remove innerJoin then it is working fine and giving expected result.
.leftJoinAndSelect(
(qb) =>
qb
.from(Email, 'email'),
'email',
'`email`.`id` = 1',
)
Any idea why is it giving me this error.