'Knex.js Postgres count intersect results

I have a knex.js query like the following:

db('table_name')
  .select('column')
  .where('condition')
  .intersect([
    db('table_name')
      .select('column')
      .where('condition')
  ]);

The query runs and returns the correct results. What I need is to count those results on the same query. I tried appending .count() at the end but it throws errors.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source