Use lucid `query()` with `db.raw()`

Hi, how would I filter with lucid after using db.raw()? i.e. here is one of my database raw

        let { rows: bills } = await db.raw(`
                CONCAT(b.month, '/', b.year) as time,
       as property_name,
       as unit_name,
                ( - as utilities_bills,
                sum(p.amount) as paid,
                COUNT( as payment_times,
                ( - sum(p.amount)) as dues
                bills b
                LEFT JOIN payments p ON p.bill_id =
                JOIN properties pr ON = b.property_id
                JOIN units u ON = b.unit_id

                ${p_id ? `WHERE b.property_id = '${p_id}'` : ''}
                ${u_id ? `WHERE b.unit_id = '${u_id}'` : ''}
                    month && year
                        ? `WHERE b.month = '${month}' AND b.year='${year}' `
                        : ''

            GROUP BY
            ORDER BY
            LIMIT ${limit}
            OFFSET ${offset}

Now I can’t use lucid query() anymore because I was using db.raw(), how would I implement this?
Because I need to chaining .where() on query()

Knex.raw query is just a single query returning whatever the underlying lib returns. There is no possibility to chain it as I know.

Have you tried to rewrite you query using query builder methods like select(knex.raw()) and etc?

Full docs just for reference: