You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I make two table aliases for the same table and then inner join one while left joining the other, the return type of my query ends up being never[].
Interestingly, if both joins to the Company table are left joins or if both joins are inner joins, it works fine, but that's not my intended behavior.
// So this worksconstdata=awaitdb.select({
referral,
fromCompany,
toCompany,}).from(referral).leftJoin(fromCompany,eq(fromCompany.id,referral.fromCompanyId)).leftJoin(toCompany,eq(toCompany.id,referral.toCompanyId));// And so does thisconstdata=awaitdb.select({
referral,
fromCompany,
toCompany,}).from(referral).innerJoin(fromCompany,eq(fromCompany.id,referral.fromCompanyId)).innerJoin(toCompany,eq(toCompany.id,referral.companyId));
Types aside, my query works as intended at runtime with one inner join and one left join.
Expected behavior
I expect that I can alias the same table twice and be able to inner join one while left joining the other.
Environment & setup
Typescript: 5.4.5
The text was updated successfully, but these errors were encountered:
What version of
drizzle-orm
are you using?0.31.1
What version of
drizzle-kit
are you using?No response
Describe the Bug
If I make two table aliases for the same table and then inner join one while left joining the other, the return type of my query ends up being never[].
Unfortunately the type of data becomes:
I've reduced the Company table to the smallest it could possibly be but it makes absolutely no difference:
Interestingly, if both joins to the Company table are left joins or if both joins are inner joins, it works fine, but that's not my intended behavior.
Types aside, my query works as intended at runtime with one inner join and one left join.
Expected behavior
I expect that I can alias the same table twice and be able to inner join one while left joining the other.
Environment & setup
Typescript:
5.4.5
The text was updated successfully, but these errors were encountered: