Ritesh Mistry
09/24/2025, 12:41 AMRJMNS
09/24/2025, 2:44 PMRitesh Mistry
09/27/2025, 11:13 PMJohn Ferlito
11/09/2025, 11:06 PMRitesh Mistry
11/10/2025, 8:41 AMJohn Ferlito
11/11/2025, 12:02 AMRitesh Mistry
11/11/2025, 12:19 PMJohn Ferlito
11/11/2025, 9:54 PMconst customerQuery = db
.selectFrom('customer')
.leftJoin('employee as salesrep', 'salesrep.id', 'customer.salesrep')
.leftJoin('term', 'term.id', 'customer.terms')
.leftJoin('currency', 'currency.id', 'customer.currency')
.leftJoin('customeraddressbookentityaddress as billingaddr', 'billingaddr.nkey', 'customer.defaultbillingaddress')
.select((eb) => [
'customer.id',
'customer.entityid',
'customer.companyname',
'customer.email',
eb.case().when('salesrep.id', 'is not', null).then(sql<string>`salesrep.firstname || ' ' || salesrep.lastname`).else(null).end().as('salesrepname'),
'term.name as paymentterms',
'currency.symbol as currency',
'billingaddr.addr1 as billingstreet1',
'billingaddr.addr2 as billingstreet2',
'billingaddr.city as billingcity',
'billingaddr.state as billingstate',
'billingaddr.zip as billingpostcode',
'billingaddr.country as billingcountry',
]);
Interestingly though somethign as simple as this returns no rows (not sure if it did before)
SELECT * FROM customeraddressbookentityaddressRitesh Mistry
11/12/2025, 11:45 AMRitesh Mistry
11/12/2025, 11:45 AMRitesh Mistry
11/12/2025, 11:47 AMRitesh Mistry
11/12/2025, 11:47 AMRitesh Mistry
11/12/2025, 11:47 AMJohn Ferlito
11/12/2025, 8:45 PMRitesh Mistry
11/12/2025, 9:19 PMRitesh Mistry
11/12/2025, 9:20 PMRitesh Mistry
11/12/2025, 9:20 PM