I have 2 models, `business` and `documents` in a `1:n` relationship, i want to filter the `business` in two ways, 

1. `business` that has `documents` where every `document.due_balance` is greater than 0
2. `business` that has `documents` where every `document.due_balance` is equals to 0

I want to make something like this

```
select
    A.name, B.due_balance, sum(B.due_balance) as total_due_balance
from
    business A
inner join documents B ON A.id = B.business_id
group by A.id
having total_due_balance > 0;

select
    A.name, B.due_balance, sum(B.due_balance) as total_due_balance
from
    business A
inner join documents B ON A.id = B.business_id
group by A.id
having total_due_balance = 0;

```

these will get me what i want, the problem, is that the previus code was made with sequelize ORM, and i can't change it, something like this

const businesses = await db.business.paginate({
 attributes: [
 ...
 ],
 where: {
 ... //bunch of where
 },
 page: parseInt(params.page, 10) || 1,
 paginate: parseInt(params.limit, 10) || 10,
});

here is where the problem begins, i don't know how to join the tables and use the having to filter it, i have tried addind this

```
let toInclude;
if (params.contactability === 'with_balance') {
    toInclude = {
        include : [
            {
                attributes: [
                    [db.Sequelize.fn('sum', db.Sequelize.col('due_balance')), 'total_due_balance'],
                ],
                model: db.document,
                as: 'documents',
                having: db.Sequelize.where(db.Sequelize.fn('sum', db.Sequelize.col('due_balance')), {
                    $gt: 0,
                }),
            },
        ],
    };
} else if(params.contactability === 'without_balance') {
    toInclude = {
        include : [
            {
                attributes: [
                    [db.Sequelize.fn('sum', db.Sequelize.col('due_balance')), 'total_due_balance'],
                ],
                model: db.document,
                as: 'documents',
                having: db.Sequelize.where(db.Sequelize.fn('sum', db.Sequelize.col('due_balance')), {
                    $eq: 0,
                }),
            },
        ],
    };
} else {
    toInclude = {};
}
const businesses = await db.business.paginate({
    attributes: [
    ...
    ],
    where: {
    ...
    },
    ...toInclude,
    page: parseInt(params.page, 10) || 1,
    paginate: parseInt(params.limit, 10) || 10,
});

```

but that does not work at all, how can i solve this problem?