limit 100

This commit is contained in:
Ken Yasue
2025-04-01 23:07:45 +02:00
parent 7fba8295c9
commit c072ae68ba

View File

@ -167,7 +167,8 @@ async function main() {
) )
.where('contact.id IS NULL') .where('contact.id IS NULL')
.andWhere('customer.email IS NOT NULL') .andWhere('customer.email IS NOT NULL')
.andWhere('customer.email != :emptyEmail', { emptyEmail: '' }); .andWhere('customer.email != :emptyEmail', { emptyEmail: '' })
.limit(100);
} else { } else {
// Find customers with exactly N email contact records // Find customers with exactly N email contact records
customersQuery = customersQuery customersQuery = customersQuery
@ -180,7 +181,8 @@ async function main() {
.where('customer.email IS NOT NULL') .where('customer.email IS NOT NULL')
.andWhere('customer.email != :emptyEmail', { emptyEmail: '' }) .andWhere('customer.email != :emptyEmail', { emptyEmail: '' })
.groupBy('customer.id') .groupBy('customer.id')
.having('COUNT(contact.id) = :count', { count: emailCount }); .having('COUNT(contact.id) = :count', { count: emailCount })
.limit(100);
} }
const filteredCustomers = await customersQuery.getMany(); const filteredCustomers = await customersQuery.getMany();