FROM customers
WHERE favorite_website = 'techonthenet.com'
AND customer_id > 6000;
How to implement this in typeorm querybuilder?
CodePudding user response:
See queryBuilder & where documentation for more information.
Without parameters:
const customers = await customerRepository
.createQueryBuilder("customer")
.where(`customer.favorite_website = 'techonthenet.com'`)
.andWhere(`customer.customer_id > 6000`)
.getMany();
With parameters:
const customers = await customerRepository
.createQueryBuilder("customer")
.where(`customer.favorite_website = :website`, { website: "techonthenet.com")
.andWhere(`customer.customer_id > :id`, { id: 6000 })
.getMany();