Select fields with the same name in two different tables in a join

Is it possible to select two fields of the same name, but from a different table, as part of a join? e.g.

    db
    .select({
      inboxCurrencyCode: inboxes.currencyCode,
      cardCurrencyCode: cards.currencyCode,
    })
    .from(transactions)
    .leftJoin(inboxes, eq(transactions.inboxId, inboxes.id))
    .leftJoin(cards, eq(transactions.cardId, cards.id))


As-is, it only ever gives me one of two currencyCode fields, even if they are technically renamed by the partial select
Was this page helpful?